Background: In my project, I can provide sys.inputs.at("target") to control the target of a document. When a target is set to "webpage", it is compiled and suitable for viewing in website. When a target is set to "ebook", it is compiled as a e-book PDF and suitable for viewing in online or offline pdf viewer.
To edit styles for document targeting to "webpage", I want to launch preview with sys.inputs arguments.
Currently there are four commands to launch preview.
- open
- open in browser
- open with slide mode
- open in browser with slide mode
As feature increased (e.g. sys.inputs), the matrix becomes larger and unmaintainable. So I want to convert the "open/launch" action into a single command. And create four corresponding auto-detected tasks to replace these commands. The final effect should look like this:

We will have these auto detected tasks (also as a start-up task template):
- open
- open in browser
- open with slide mode
- open in browser with slide mode
And we can invoke a typst-preview.launch command in task:
All of arguments in typst-preview.launch are optional so we can also have a default command to launch without configuration or interactively.
And we can disable auto detected tasks as user preferences.
https://github.com/microsoft/vscode/blob/c7ea84b4f5e779a98e93bd1f48502d83403f16c3/extensions/gulp/src/main.ts#L140-L150
{ "version": "2.0.0", "tasks": [ { "label": "preview", "command": "${command:typst-preview.launch}", "args": { "openIn": "webview", // v.s. in browser "mode": "document", // v.s. slide mode "inputs": { "target": "webpage", "theme-setting": "themes/ayu.toml" } } } ] }