js65 for VS Code
Language support for js65 6502 assembler, backed by the js65 assembler.
Features
- Diagnostics as you type, with the include/macro-expansion trail attached
as related information. On save the linker also runs, surfacing
segment-overflow errors without a build.
- Go to definition / find references across a whole assembly unit, including
through
.include chains.
- Document and workspace symbols for labels, constants, macros, and scopes.
- Hover for a symbol's resolved value (hex and decimal) and scope path, the
addressing modes a mnemonic supports, or a macro's parameter list.
- Completion aware of cursor position. Directives after
., mnemonics and
in-scope symbols mid-line, etc.
- Folding on
.scope, .proc, .macro, .repeat, .struct, .enum.
- Semantic highlighting on top of the bundled TextMate grammar.
- Expand Macro at Cursor (
js65.expandMacro).
Project setup
Add a js65.json at the workspace root to describe how your sources are built into the final output
{
"projects": [
{
"name": "main",
"sources": ["src/**/*.s"],
"includePaths": ["inc"],
"target": "nes-nrom"
}
]
}
Or call js65 init <foldername> to create a basic project folder structure.
<foldername> is an optional folder to create the project in, it will use the current folder if its not provided.
Each project in the js65.json file is one independently assembled and linked program.
If you need to compile multiple files in sequence, the sources field is compiled in order from first to last.
If that is not enough, then you can always create multiple projects with compileOnly: true, and then combine all the outputs at the end.
Without a js65.json, files are analyzed standalone so things like syntax errors, navigation, and hover still work, and references to symbols defined in other files are reported as warnings rather than errors.
Language id
This extension contributes the language id js65 (shown as "js65 Assembly") with grammar scope source.js65, for files with the extensions .s, .asm, .inc, and .mac.
If you have a different language extension that takes the .s, then you can associate them with js65 using the following
{ "files.associations": { "*.s": "js65", "*.inc": "js65" } }
Settings
| Setting |
Default |
What it does |
js65.server.enable |
true |
Turn the language server off, leaving syntax highlighting only. |
js65.server.path |
null |
Absolute path to a js65-lsp.cjs you built yourself. Unset uses the bundled copy. |
js65.trace.server |
off |
Log JSON-RPC traffic to the js65 Language Server output channel. |
Commands
| Command |
Description |
js65: Expand Macro at Cursor |
Expand the macro invocation under the cursor. |
js65: Restart Language Server |
Restart the server, e.g. after changing js65.server.path. |
js65: Show Language Server Output |
Open the server's output channel. |
Building from source
Requires bun on PATH.
bun install
bun run build # bundle the extension and compile the tests
bun run build:server # build lsp/server and copy the bundle into server/
bun run package # produce a .vsix
bun run test # end-to-end suite inside a downloaded VS Code
License
MPL-2.0. See LICENSE.txt at the root of the js65 repository.
AI (LLM) Policy
See LLMContributions.md at the root of the js65 repository.