Maintain the FOnline VS Code Extensions
This guide is for Engine contributors who change BuildTools/fonline-tools (FOnline Tools) or BuildTools/angelscript-debugger (the FOnline AngelScript debugger). Both are working Engine-owned tools: projects load them as source folders from BuildTools through tracked workspace symlinks. The guide describes the source layout, the build and test commands, which committed output is the runtime entry, how to change the label grammar without breaking project workspaces, and the checks a change needs, including what the automated tests do not cover.
Source paths inspected
.gitignore.gitattributes.github/workflows/validate.ymlBuildTools/fonline-tools/package.jsonBuildTools/fonline-tools/tsconfig.jsonBuildTools/fonline-tools/.gitignoreBuildTools/fonline-tools/src/extension.tsBuildTools/fonline-tools/src/jsonc.tsBuildTools/fonline-tools/src/tests/jsonc.test.tsBuildTools/fonline-tools/dist/extension.jsBuildTools/angelscript-debugger/package.jsonBuildTools/angelscript-debugger/tsconfig.jsonBuildTools/angelscript-debugger/.gitignoreBuildTools/angelscript-debugger/src/extension.tsBuildTools/angelscript-debugger/src/activateFosDebug.tsBuildTools/angelscript-debugger/src/attachDiscovery.tsBuildTools/angelscript-debugger/src/debugAdapter.tsBuildTools/angelscript-debugger/src/fosDebug.tsBuildTools/angelscript-debugger/src/fosRuntime.tsBuildTools/angelscript-debugger/src/web-extension.tsBuildTools/angelscript-debugger/src/tests/adapter.test.tsBuildTools/angelscript-debugger/src/tests/attachDiscovery.test.tsBuildTools/angelscript-debugger/dist/extension.jsBuildTools/angelscript-debugger/dist/debugAdapter.jsBuildTools/tests/test_docs_debugging.pyDocs/en/troubleshooting/debugging.mdDocs/en/how-to/project/vscode-workspace.mdDocs/en/contributing/documentation/index.mdDocs/en/how-to/release/versioning.md
Layout
Extension maintenance lives under contributing/tooling because the audience is Engine contributors, not game teams. Game teams use Set Up a VS Code Workspace for an FOnline Project.
FOnline Tools
| Path | Role |
|---|---|
package.json |
Extension manifest: command and keybinding contributions, activation, scripts. main is ./dist/extension.js. |
src/extension.ts |
Menu building, platform filtering and hotkeys, one file of about 480 lines. |
src/jsonc.ts |
The parser for .vscode/tasks.json: strict JSON plus comments, trailing commas and a leading byte-order mark, the relaxed syntax VS Code accepts. |
src/tests/jsonc.test.ts |
node:test unit tests of the parser. |
tsconfig.json |
CommonJS, ES2020, strict, noUnusedLocals, noEmit: tsc only typechecks, esbuild writes the bundle. |
dist/extension.js, dist/extension.js.map |
Committed esbuild bundle. This is what VS Code runs. |
.gitignore |
Ignores test-out/, where npm test writes the bundled tests. |
There is no README, icon or .vscodeignore, and no package script: the Engine delivers the extension as a source folder, and projects install it through the workspace symlink described in the workspace guide.
AngelScript debugger
| Path | Role |
|---|---|
package.json |
Manifest: fos language, grammar, fos debugger type, attach properties, scripts. main is ./dist/extension.js. |
src/extension.ts, src/activateFosDebug.ts, src/web-extension.ts |
Extension host entry points; activateFosDebug.ts holds the configuration provider that runs attach discovery and applies the processId filter. |
src/debugAdapter.ts, src/fosDebug.ts, src/fosRuntime.ts, src/attachDiscovery.ts |
The debug adapter, its sample runtime and UDP/TCP attach transport. attachDiscovery.ts also holds the target selection shared by the configuration provider and the adapter. |
src/tests/ |
adapter.test.ts with its data files, and attachDiscovery.test.ts. |
dist/extension.js, dist/web-extension.js, dist/debugAdapter.js (+ maps) |
Committed bundles. contributes.debuggers[].program is ./dist/debugAdapter.js. |
sublime-angelscript/, language-configuration.json, icon.png |
Grammar and editor assets contributed to VS Code. |
.gitignore |
Ignores test-out/, where npm test writes the bundled tests. |
The adapter’s run mode is a compile-time constant in src/extension.ts (runMode), currently inline. Discovery needs Node’s UDP module and is unavailable in the browser bundle; src/attachDiscovery.ts reports that, and the configuration provider then asks for an explicit tcp:// endpoint.
Which output is the runtime entry
Both extensions load dist/extension.js (main in each package.json), and dist/ is the only build output either package tracks. Neither tsconfig.json emits: tsc runs only as npm run typecheck, and esbuild produces every bundle. A change to src/ has no effect for users until dist/ is rebuilt from it and committed together with the source.
Prerequisites and commands
Both packages are standalone npm projects; neither is built by CMake or by any Engine workflow. Use Node.js 18.18 or newer with npm: the test scripts rely on node:test and on mocha 11. The results below come from Node 24.16.0 and npm 11.13.0 on Windows, in scratch copies of each package outside the repository, with TypeScript 4.9.5, esbuild 0.28.2 and @types/vscode 1.89.0.
No package-lock.json is committed: the repository .gitignore ignores package-lock.json except for two named test and docs packages. Dependencies therefore float within their declared ranges. Two ranges are deliberately narrow: typescript is ^4.9.5 because the sources use the satisfies operator, and @types/vscode is ~1.89.0, the minimum editor version in engines.vscode, so that typecheck rejects newer VS Code API.
FOnline Tools
Run from BuildTools/fonline-tools:
npm install
npm test
npm run build
| Script | Command it runs |
|---|---|
typecheck |
tsc -p tsconfig.json --noEmit |
build |
esbuild ./src/extension.ts --bundle --tsconfig=./tsconfig.json --external:vscode --format=cjs --platform=node --outfile=dist/extension.js --sourcemap --sources-content=false |
watch |
The build command with --watch |
test |
typecheck, then esbuild bundles src/tests/jsonc.test.ts into test-out/ and node --test runs it |
vscode:prepublish |
The esbuild command with --minify |
Observed behavior in the scratch copy: npm run typecheck passes, npm test passes its five parser tests, and npm run build reproduces the committed dist/ files apart from line endings. The tests cover only the parser; menu building, platform filtering and hotkeys need the VS Code API. They were checked by running the bundle against an ad-hoc stub of that API, which is not part of the repository.
AngelScript debugger
Run from BuildTools/angelscript-debugger:
npm install
npm test
npm run build
| Script | Command it runs |
|---|---|
typecheck |
tsc -p tsconfig.json --noEmit |
build |
The esbuild-base, esbuild-web and esbuild-adapter bundles with source maps |
test |
typecheck, build, then esbuild bundles src/tests/*.test.ts into test-out/tests/ and mocha --ui tdd runs them |
watch, watch-web |
Watch builds of the extension and web bundles |
vscode:prepublish |
rimraf dist plus minified builds of all three bundles |
package, publish, publish-pre-release |
vsce commands; the Engine does not package or publish a VSIX, projects use the symlinked folder |
Observed behavior in the scratch copy: npm run typecheck passes, and npm test passes 13 tests. Eight are the adapter tests in adapter.test.ts: they start the rebuilt dist/debugAdapter.js over the Debug Adapter Protocol and run the sample runtime on the Markdown data files, so they check the adapter’s protocol handling, not the live Engine endpoint. Five are unit tests of attach target selection: an unset filter, an exact processId match, a bare process id that matches nothing, duplicate ids from several hosts, and an explicit endpoint. Because npm test rebuilds dist/ before the adapter tests, run it before you commit so that the committed bundles match the source. The package has no lint script; typecheck under strict and noUnusedLocals is its static check.
The adapter’s delivery status (private package, source folder installed through a symlink, no lock file, no VSIX, adapter tests against the sample runtime only) is recorded in Adapter delivery status. Keep that page and its test, BuildTools/tests/test_docs_debugging.py, consistent when you change the package.
Extend the label grammar safely
The grammar is implemented only in BuildTools/fonline-tools/src/extension.ts. Projects depend on every detail described in the workspace guide. Changing a tag, a precedence rule or a hotkey rule changes the menu of every project that uses the extension, and the Engine has no versioned contract for it.
Procedure for a grammar change:
- Read the current behavior in the workspace guide and the functions it describes. Platform filtering is one function,
matchesCurrentPlatform, shared by tasks, launch configurations and compounds. Label stripping isstripPlatformTags, and grouping isparseGroupedTaskName. - Change the source. The task path (
getTaskPicks) and the launch path (getLaunchPicks) duplicate the grouping code; update both. The menu and the hotkeys share one list,getTopLevelPicks, which every hotkey press rebuilds, so there is no separate hotkey cache to keep in step. Keepsrc/jsonc.tsaccepting what VS Code accepts intasks.json, and extendsrc/tests/jsonc.test.tswhen you change it. - Keep tags inside the label or name. Removing a tag from the stored string would break
dependsOn,preLaunchTaskand compound references in existing projects. - When a hotkey or command changes, update
contributes.commandsandcontributes.keybindingsinpackage.json;MAX_SORT_HOTKEYSin the source and the nine contributed commands must agree. - Run
npm testandnpm run build, then commitsrc/and the rebuiltdist/together. A change without a rebuiltdist/has no effect for users, becausedist/is the entry point. - Update the workspace guide and its Russian mirror, including the label grammar table, the platform rules and the validation checklist. Update the debugging guide only if attach behavior changed.
- Add a changelog entry under the rules in versioning and describe the behavior change for embedding projects, because an existing
tasks.jsonmay stop matching.
The automated tests of FOnline Tools cover only the tasks.json parser. The menu itself is checked by hand: open a scratch workspace with a tasks.json and a launch.json, run FOnline: Show Tools and a few hotkeys, edit a [sort:N] label and press its hotkey again, and walk the checklist in the workspace guide on each host platform you claim.
Change checklist
- The change is in
src/, anddist/was rebuilt withnpm run buildfrom the same source. npm testpasses in each changed package; it includestypecheck, which accepts no errors.dist/was not hand-edited.- Label grammar,
tasks.jsonparsing and hotkey behavior were re-read against the source and are reflected in the workspace guide, English and Russian. - The labels in the workspace guide’s
tasks.jsonandlaunch.jsonstill produce the same menu. package.jsoncontributions agree with the source.- For the debugger: attach properties in
package.json, the configuration provider and the debugging guide agree, and the delivery-status wording in the debugging guide andtest_docs_debugging.pystill holds. - The documentation gates in documentation maintenance pass, and the changelog entry exists.
Coverage summary
| Area | Automated coverage |
|---|---|
| Typecheck of both packages | npm run typecheck, part of each npm test |
FOnline Tools tasks.json parser |
npm test: src/tests/jsonc.test.ts |
| FOnline Tools menu, platform filtering and hotkeys | None; manual check above |
| Debugger adapter protocol handling | npm test: src/tests/adapter.test.ts against the sample runtime, through the rebuilt dist/debugAdapter.js |
| Debugger attach target selection | npm test: src/tests/attachDiscovery.test.ts |
| Debugger package metadata | Documentation test BuildTools/tests/test_docs_debugging.py |
| UDP discovery and live attach to an Engine process | None |
The package tests run on a developer machine. .github/workflows/validate.yml runs none of them: its only Node.js setup belongs to the documentation browser job, which installs from a committed lock file, and the extension packages have no lock file.