FlyEngine for VS Code
IntelliSense for FlyEngine scripting.
Z# (.zs)
- Syntax highlighting (high and low level,
cpp { } blocks highlighted as C++, string interpolation).
- Snippets:
zshigh, zslow, onupdate, onkey, forrange, class, create, ...
- Engine API completion, hover and signature help for
game, input, tick, math, vec, Object members and the
string/list/map methods. This is static (data/api.json) and works without the language server.
- Language server (
zs-lsp, tools/zs-lsp) for everything about your code:
- Diagnostics from the engine's own compiler, as you type: the same errors and "did you mean" hints Play would give,
including errors caused by
#included files.
- Go to definition for variables, functions, classes, parameters and locals,
this.field / this.method() (inherited
ones too), module.name across files, #include(path) (opens the file), and struct fields in low-level files.
- Hover with the declaration and the
# / // comment lines directly above it.
- Completion of names in scope, class members after
this., a module's contents after alias., and project modules
inside #include(.
- Outline / breadcrumbs (
Ctrl+Shift+O), with class members nested.
Not in this version: rename, find references, signature help for your own functions, and type-aware completion (after
someVar. you get every user-defined member we know of, plus the engine API from the static provider).
While a file has a syntax error the parser stops at it, so the outline and completion use the last version that parsed.
Getting the language server
Build it from the repo (it has no engine or window dependencies):
cmake --build <build-dir> --target zs-lsp
Then point flyengine.languageServerPath at the result, or copy it to tools/vscode-flyengine/bin/, or put it on PATH.
Without it the extension still gives highlighting, snippets and API completion, and tells you once that the server is missing.
C++ scripts
Run FlyEngine: Configure C++ IntelliSense for scripts. It writes .vscode/c_cpp_properties.json
(C++20, fly.hpp on the include path) for Microsoft's C/C++ extension. FlyEngine also writes a .clangd
into projects, so clangd works without this step.
The SDK is found at ScriptingSDK/include near the workspace, or set flyengine.sdkPath.
Keeping it in sync
data/api.json mirrors section 12 of docs/guide/ZSharp.md. Update it when the Z# stdlib grows.
Develop
cd tools/vscode-flyengine && npm install
npm test # static providers; set ZS_LSP=<path to zs-lsp> to include the protocol test
Open the folder in VS Code and press F5 (Extension Development Host). Package with npx @vscode/vsce package
(copy zs-lsp into bin/ first to ship it inside the extension).