Run Hono CLI requests directly from your route definitions via CodeLens, and debug hono serve from the active file.
This extension ships with bundled @hono/cli and runs hono request / hono serve for you.
- CodeLens on routes (CodeLens-only; not available as Command Palette commands)
- Detects route definitions such as
app.get('/path', ...)androuter.post("/path", ...) - Shows CodeLens actions right above the route
- Detects route definitions such as
- CodeLens: Run
- Executes
hono requestfor the selected route - Shows results in Output (
Hono)
- Executes
- CodeLens: Watch
- Executes
hono request --watchin an integrated terminal
- Executes
- CodeLens: Debug
- Launches
hono requestwith Node inspector (--inspect) - Lets you hit breakpoints in your Hono app code while running a request
- Launches
- Command: Hono: Debug
- Runs
hono servein debug mode using the active editor file as the entry point - Starts a Node debug session (integrated terminal)
- Runs
- Open a Hono app file (TypeScript/JavaScript) that contains
new Hono. - Hover around a route definition such as
app.get("/hello", ...). - Click a CodeLens action:
- Run: runs a single request and prints output to the Output panel
- Watch: runs in an integrated terminal; stop it with
Ctrl+C - Debug: starts a debug session with the Node inspector while running the request
- Open the file you want to use as an entry point (active editor).
- Run Hono: Debug from the Command Palette.
- The extension runs
hono servein debug mode and starts a Node debug session.
If your route path contains placeholders like /posts/page/:page, the extension will prompt you for values and then run the request with the resolved path.
You can configure the extension via VS Code Settings:
hono.request.enableCodeLens("auto" | "always" | "disabled")- Default:
"auto" "auto": only show CodeLens in files containingnew Hono"always": show CodeLens for all supported route calls"disabled": never show CodeLens
- Default:
hono.request.nodePath(string)- Default:
"node" - Node executable used to run the bundled
@hono/cli
- Default:
hono.request.extraArgs(string[])- Extra arguments appended to
hono requestandhono serve
- Extra arguments appended to
- Route path must be a string literal:
app.get('/path', ...)app.get("/path", ...)app.get(`/path`, ...)
-
No CodeLens is shown
- Make sure the file contains
new Hono - Ensure
hono.request.enableCodeLensis enabled - Make sure the route path is a string literal (see supported syntax)
- Make sure the file contains
-
Watch mode breaks when passing request body
- Watch mode runs in a terminal, so shell quoting may matter depending on your environment.
Build and install the VSIX locally:
npm install
npm run package
code --install-extension "hono-$(node -p \"require('./package.json').version\").vsix" --force- Taku Amano https://github.com/usualoma
- Yusuke Wada https://github.com/yusukebe
MIT