Inspired by esbuild-problem-matchers and tsup-problem-matchers.
VS Code problem matchers for tsdown (Rolldown) CLI output, so build/watch tasks populate Problems with file, line, and column.
Builtin problem matchers
| Matcher | Use case |
|---|---|
$tsdown |
One-shot tsdown / tsdown build: Rolldown diagnostics such as [PARSE_ERROR] Error: followed by a location line (src/file.ts:line:col). |
$tsdown-watch |
tsdown --watch: background begins on Build start, ends on Rebuilt in, Build complete in, or the stack footer line at async runCLI (failed watch runs). |
$tsdown-dts |
tsdown --dts: base is VS Code’s built-in $tsc. Use when declaration emit surfaces classic tsc-shaped diagnostic lines. |
$tsdown-dts-watch |
--dts --watch: same $tsc-style diagnostics with the same background as $tsdown-watch. |
Bundled errors are matched from output like:
\[SOME_CODE\] Error:… (message) on one line, then a second line containingpath/to/file.ts:line:colinside the Rolldown pretty-printed frame (ANSI codes are tolerated). This matches tsdown0.21.x/ Rolldown1.0.0-rc.xin this repo’splayground.
If your tsdown version changes the log format, adjust the patterns in package.json and use playground to re-check.
--dts and $tsdown-dts
Many projects still benefit from listing $tsdown-dts next to $tsdown: when TypeScript reports declaration issues in a tsc-compatible shape, they are picked up. If tsdown does not fail the build on a type mismatch (emit continues), you may rely on $tsc / editors alone — see the tsdown docs for your version’s behavior.
Usage in tasks.json
npm script, one-shot build:
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "build",
"group": "build",
"problemMatcher": ["$tsdown", "$tsdown-dts"],
"label": "npm: build"
}
]
}
Watch / dev server (tsdown --watch), background task:
{
"type": "npm",
"script": "dev",
"group": "build",
"problemMatcher": ["$tsdown-watch", "$tsdown-dts-watch"],
"isBackground": true,
"label": "npm: dev"
}
Shell task (e.g. npm run dev --loglevel silent), like a VS Code extension repo:
{
"label": "dev",
"type": "shell",
"command": "npm",
"args": ["run", "dev", "--loglevel", "silent"],
"isBackground": true,
"problemMatcher": ["$tsdown-watch", "$tsdown-dts-watch"],
"group": { "kind": "build", "isDefault": false },
"presentation": { "reveal": "silent", "panel": "shared" }
}
Use $tsdown / $tsdown-dts for non-watch build, and $tsdown-watch / $tsdown-dts-watch when the task stays running.
Turborepo / task runners with prefixed lines
If each log line is prefixed (for example with the package name), override the background patterns while inheriting the rest, similar to tsup-problem-matchers:
{
"problemMatcher": [
{
"base": "$tsdown-watch",
"background": {
"activeOnStart": true,
"beginsPattern": "your-pkg-name: .*Build start",
"endsPattern": "your-pkg-name: .*(Rebuilt in|Build complete in|at async runCLI)"
}
}
]
}
Tune beginsPattern / endsPattern to the exact prefix your runner prints.
Develop this extension
pnpm installat the repo root (installs@vscode/vscefor packaging).- Run Extension (F5): use Run and Debug and pick the appropriate launch config:
- Opening the repo root (
tsdown-problem-matchers): choose Run Extension in.vscode/launch.json. The host opens with theplaygroundfolder loaded. - Opening only the
playgroundfolder: if the debug sidebar asks you to createlaunch.json, you are not at the repo root—either File → Open Folder… and selecttsdown-problem-matchers(root), or use Run Extension (develop from playground folder) inplayground/.vscode/launch.json.
- Opening the repo root (
- Run a task in the host window (the window that opens after F5—the one with
playgroundas the workspace). F5 does not run tasks for you; you start them explicitly:- From the menu: Terminal → Run Task… (or Run Build Task if you rely on the default build task).
- From the Command Palette (
Ctrl+Shift+P/Cmd+Shift+P): run Tasks: Run Task, then pick a task by its label fromplayground/.vscode/tasks.json, for example:playground: tsdown build (error sample)— failed build; use this to confirm$tsdownpopulates Problems from terminal output.playground: tsdown build— successful build;playground: tsdown watch— watch mode (background task; uses$tsdown-watch).
- From an integrated terminal in that same host window:
cdtoplaygroundif needed, then run the same scripts (e.g.pnpm run build:error). Tasks are preferred when you want the configured problemMatcher applied automatically. - Open the Problems panel to see diagnostics (e.g.
tsdown(PARSE_ERROR)from the matcher vsts(…)from the TypeScript language service).
Package a .vsix:
pnpm run package