SANE / TRSE VSCode extension
This extension adds syntax highlighting and build functionality to VSCode for SANE or TRSE projects:
It works both with SANE (a C64-only TRSE cli fork) and with the original, multi-platform TRSE. It doesn't matter which one you're using.
Before you start
You need a compiled TRSE/SANE executable on your computer (usually a file called trse / trse.exe). If your computer can already find it on its own, you don't need to do anything. If not, you must tell the extension where it is. (See "Compiler Path" in the settings table below)
How to build your project
- Open your project's folder in VSCode: File menu, Open Folder..., and pick the folder that contains your
.trse files.
- Press Ctrl+Shift+B (on a Mac: Cmd+Shift+B). This is VSCode's standard shortcut for "build my project."
- If VSCode asks you to pick a build task (this only happens the first time, or if you have more than one set up), choose "SANE / TRSE: Build" from the list.
- If the build succeeds, you'll see a short summary: how many lines of code you have, and the size of the file it produced.
- If the build fails, the file with the error opens automatically, and the bad line is highlighted in red with the error message shown right next to it. You don't have to read through the output panel to find it yourself.
If pressing Ctrl+Shift+B doesn't do anything, or runs something else entirely, see "Using a different build shortcut" near the bottom of this page.
Changing settings
- Press Ctrl+Shift+P. A search box opens at the top of the window (the "Command Palette")
- Start typing
SANE / TRSE: Configure and select it from the list
- A list appears with everything you can configure.
- Recommended/required settings: (see the table below)
- Compiler path
- Project file
- Input file
- Input file mode
- Emulator path
All settings, in one place
Press Ctrl+, (the comma key) to open Settings, then type sane-trse into the search box at the top. Every setting below will show up there with a box to type or pick a value.
| Setting |
What it does |
Default |
| Compiler Path |
Where your compiled trse program is, if VSCode can't find it by itself. |
(tries to find it automatically) |
| Project File |
Which .trse project file to build. |
(picked automatically if there's only one) |
| Input File |
Which .ras file is your program's starting point. |
(whichever file you currently have open) |
| Input File Mode |
Whether to always build the file above, or always build whatever file you happen to have open right now. |
Use the file above |
| Assemble |
Whether to also turn the compiled code into a runnable program, not just check it for mistakes. |
On |
| Error Highlight Mode |
Whether an error's explanation is always shown next to the highlighted line, or only appears when you move your mouse over it. |
Always shown |
| Show Build Stats |
Whether to print a short summary (line counts, output size) after a successful build. |
On |
| Post Build Command |
A command that runs automatically right after a successful build, before an emulator opens. Optional, for advanced use (e.g. copying a file somewhere). |
(none) |
| Emulator Path |
An emulator program to open automatically after a successful build, so you can try your program right away. |
(none - nothing opens) |
| Emulator File Type |
Which of the build's output files to hand to the emulator (for example d64 or prg). |
(figured out automatically) |
Using a build shortcut
- Press Ctrl+Shift+P to open the Command Palette.
- Type Tasks: Configure Default Build Task and press Enter.
- A list appears with every build command VSCode knows about. Click "SANE / TRSE: Build".
From now on, Ctrl+Shift+B will run this extension's build.
Setting up your own shortcut (e.g. Ctrl+E)
Press Ctrl+Shift+P to open the Command Palette.
Type Preferences: Open Keyboard Shortcuts (JSON) and press Enter. A file opens, this is where every custom shortcut you set up lives.
Put your new shortcut here:
[
{
"key": "ctrl+e",
"command": "workbench.action.tasks.runTask",
"args": "SANE / TRSE: Build"
}
]
Save the file (Ctrl+S). Ctrl+E will now run the build - change "ctrl+e" to any other key combination you'd rather use instead (e.g. "ctrl+alt+b").
If your chosen key combination is already used for something else, this new shortcut will run alongside (or instead of) the old one, which can be confusing. To check first: open Preferences: Open Keyboard Shortcuts (without "(JSON)" - this opens a searchable list instead of the raw file) and type the key combination into its search box to see what, if anything, already uses it.
Things this doesn't handle yet
- If your project is set up to use a different assembler (DASM instead of the default, OrgAsm), its errors won't be shown nicely.
- Every once in a while, the compiler reports an error on the wrong line, off by one or two. This extension tries to auto-correct that when it can, but it isn't guaranteed to catch every case.
SANE
This is part of the SANE project, big thanks to leuat and to the original TRSE.