Language support for LostCity-style RuneScript: .rs2 scripts and the config formats
(.npc .obj .loc .seq .spotanim .varp .varbit .varn .varo .vars .inv .enum .struct .param .dbtable .dbrow .idk .mesanim .flo .hunt .hitsplat .if .constant .pack).
- Syntax highlighting (the grammar mirrors the lexer in
ares-compiler/src/lexer.rs). - A badge icon per file type (one language id per config extension).
- Outline, breadcrumbs and folding for
[trigger,subject]scripts and[name]sections. - Colour swatches for
0xRRGGBBvalues in configs. - A visual interface editor for
.iffiles (opens by default, or as text withrunescript.interfaceEditor.openWith; "Open as Text" or Reopen Editor With switch one file): a pixel-exact preview drawn with the client's own sprite, font and layout rules (models show as placeholders), drag to move and resize, a layers panel (draw order, nesting, show/hide and lock in the preview, solo, search, thumbnails, multi-select, group/ungroup, duplicate, copy/paste between files, rename), a toolbox (Move V, Select M, Hand H / Space, Zoom Z, draw Rect R / Text T / Layer L, Eyedropper I, Measure U), palettes for component types, sprites, fonts and colours, an inspector for keys, right-click options and scripts. New and deleted components get or lose theirpack/interface.pack/pack/interface.orderids when the file is saved. "Open as Text" switches back. - From the
runescript-lsplanguage server (shipped inbin/):- compiler diagnostics as you type
- hover with types, signatures and
// info:docs - go to definition and find references for locals, procs, labels, commands, config names, constants and
iface:com - completion after
~ @ $ % ^, in[triggerheaders, and of config names and locals where an argument ordef_<type>initializer expects that type - signature help and parameter-name inlay hints
- rename (F2) for locals, procs, labels, constants, config names and interface components (also their
[name]line, config values naming them and the.packline, so ids stay put) - highlight of the symbol under the cursor, workspace symbol search (Ctrl+T)
- in config files: key and value completion, warnings for unknown keys, bad values and unknown names, go to definition and references through values, sprite and texture previews on hover
Open a Content checkout. The server builds the compiler's symbol tables (commands, config names and
types, constants, interfaces, db columns) from the workspace's pack/*.pack, .constant and config
files, so nothing needs building first and a new varp or .pack line is known as soon as it is typed.
| Setting | Meaning |
|---|---|
runescript.server.path |
A runescript-lsp binary to use instead of the bundled one. |
runescript.trace.server |
Protocol tracing in the output panel. |
runescript.diagnostics.configWarnings |
Off mutes unknown-key, bad-value and unknown-name warnings in config files. |
runescript.contentRoot |
The Content folder for the interface editor, when it is not above the .if file. |
runescript.interfaceEditor.openWith |
visual or text; writes workbench.editorAssociations["*.if"] at the same scope. |
runescript.interfaceEditor.zoom, .gridSize, .grid, .smartGuides |
Starting zoom, grid spacing, grid snap and smart guides for a newly opened editor (a reopened panel keeps its own). |
Config checks and navigation follow the key table in
runescript-lsp/src/config_keys.rs, transcribed from the ares-gameserver config parsers.
RuneScript: Restart Language Server restarts the server. If no server binary is found,
go to definition falls back to a regex index.
npm install
npm run gen # regenerate data/syntax.json from ares-compiler + ares-shared, then grammars, icons, languages
npm test # tsc, node --test, grammar snapshots
npm run snap # re-record grammar snapshots after an intentional grammar change
npm run package # builds ../runescript-lsp, copies it to bin/, writes the win32-x64 .vsix
F5 opens an Extension Development Host on ../Content. File types, their icons and
language ids come from FILE_TYPES in scripts/gen-grammar.mjs. Trigger and type names
come from the Rust crates, so rerun npm run gen after adding a trigger or var type.