Start/stop the Mockoro local server from VS Code with a single command and automatically inject the workspace mock.yaml.
Features
One‑click control: Start/stop the Mockoro server via the Command Palette
Port auto selection: Finds an available port in the 3000–3999 range
Config injection: If mock.yaml exists at the workspace root, inject it as MOCK_YAML_PATH
Bundled runtime: Runs the server from the packaged out/server/index.mjs
Status & logs: In‑editor status notifications with [mockoro] prefixed logs
Commands
Run from the Command Palette (Ctrl+Shift+P / Cmd+Shift+P):
Mockoro: Start (mockoro.start): Start the server
Mockoro: Stop (mockoro.stop): Stop the server
Settings
In VS Code settings:
{
"mockoro.autoStart": false
}
mockoro.autoStart (boolean, default false): Automatically start Mockoro when VS Code launches
Usage
Open a project that contains mock.yaml (optional; if absent, MOCK_YAML_PATH is not set)
Run Mockoro: Start
After the success notification, visit an address like http://localhost:3000
To stop, run Mockoro: Stop
Note: The current implementation picks mock.yaml from the first workspace folder. Auto‑restart on file change is not enabled (a watcher scaffold exists in code).
Logs & Troubleshooting
Missing server directory: If you see “service directory not found: <.../out/server>”, ensure the build includes out/server/index.mjs
Port already in use: The extension will try other ports automatically; if it still fails, check local listeners or firewall
View logs: Inspect [mockoro] logs in the Output/Debug Console
# Install deps and build inside the vscode-extension directory
npm i
npm run compile
# Package VSIX (requires vsce or the provided npm script)
npm run package
The runtime entry is out/server/index.mjs and should be shipped with the VSIX.