Skip to content

feat(vite-task): show task sources and open them in the editor - #653

Open
SaKaNa-Y wants to merge 11 commits into
vitejs:mainfrom
SaKaNa-Y:feat/vite-task-source
Open

SaKaNa-Y wants to merge 11 commits into
vitejs:mainfrom
SaKaNa-Y:feat/vite-task-source

Conversation

@SaKaNa-Y

@SaKaNa-Y SaKaNa-Y commented Nov 28, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

The Commands tab shows what packages/config#verify runs. To edit verify, you still have to find its declaration in the package.

Task details
├─ package.json script → Open script definition → the selected key in package.json
└─ Vite configuration  → Open package config    → the package’s sole standard Vite config file

The config file can import the task definition. If the host cannot open an editor or the package has no unique target, the panel still shows the source label.

Evidence

Before After
Commands tab showing the three steps of verify The same task with its source label and Open script definition button
  • In the earlier playground check, Open script definition opened VS Code at packages/config/package.json:9, on verify between preverify and postverify.
  • The config action passed the sole vite.config.ts to the editor without evaluating it. After a second standard config file appeared, the next click hid the button and kept the source label.
  • With Vite+ 1.6.0, adding or removing a same-name script during refresh left the source as Unknown and made no editor call. A task that generated a different command on every load opened its package’s vite.config.mjs on the first load.
  • When a click failed, the details panel showed the recovery step for that failure. An editor error kept its own message even when the script disappeared before the panel refreshed.
  • All 39 Vite Task tests passed.

Merge Danger

Door: two-way

Reverting the change requires no migration.

Blast Radius: navigation

Vite Task reads package manifests in batches before and after one graph query. Complex workspace patterns can require scanning more directories. When a script changes during that query, its editor action stays hidden until a refresh can confirm its source.

Show whether a selected task comes from a package script or Vite configuration. Recheck the script key before opening it, and resolve the current package config with the workspace Vite+ loader on demand.

Offer the editor action only when the host provides it.
@pkg-pr-new

pkg-pr-new Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@vitejs/devtools

npm i https://pkg.pr.new/vitejs/devtools/@vitejs/devtools@653

@vitejs/devtools-kit

npm i https://pkg.pr.new/vitejs/devtools/@vitejs/devtools-kit@653

@vitejs/devtools-oxc

npm i https://pkg.pr.new/vitejs/devtools/@vitejs/devtools-oxc@653

@vitejs/devtools-rolldown

npm i https://pkg.pr.new/vitejs/devtools/@vitejs/devtools-rolldown@653

@vitejs/devtools-vite

npm i https://pkg.pr.new/vitejs/devtools/@vitejs/devtools-vite@653

@vitejs/devtools-vite-task

npm i https://pkg.pr.new/vitejs/devtools/@vitejs/devtools-vite-task@653

@vitejs/devtools-vitest

npm i https://pkg.pr.new/vitejs/devtools/@vitejs/devtools-vitest@653

commit: eedfbdc

@SaKaNa-Y
SaKaNa-Y marked this pull request as draft November 28, 2026 09:31
Handle UTF-8 BOMs and Vite+ workspaces without a root manifest. Resolve the current target both when showing an action and when opening it. Refresh availability after a failed click so stale targets disappear and editor failures remain retryable.
Read up to 16 manifests per batch so large workspaces can identify task sources under a low file descriptor limit.
Compare the command and source kind from the displayed graph with the indexed task before offering or opening its source. Keep the newest successful index when overlapping refreshes finish out of order.
A manifest save can remove a script after the CLI has included it in the graph. Compare the source before and after the graph read for known packages. Confirm inferred config tasks from newly discovered packages in one additional graph query.
Read member manifests before and after Vite+ returns the task graph.
Only offer an editor action for a string command when both reads agree
on its source. This catches same-name source changes and keeps generated
commands available on the first load with a single Vite+ graph query.
Return the diagnostic and its recovery together when the task panel
requests them. Give an unreadable manifest its own diagnosis. Check
button availability separately so a later file change preserves the
original editor error and its recovery.
@SaKaNa-Y
SaKaNa-Y marked this pull request as ready for review December 1, 2026 08:10
@SaKaNa-Y
SaKaNa-Y requested a review from webfansplz December 1, 2026 08:10
@webfansplz

Copy link
Copy Markdown
Member

Thanks for working on this! Being able to jump from a task to the script that defines it would save a manual lookup, especially in a monorepo.

Could you open an issue in vite-task first to ask whether vp run --json could include a source field for each task? The runner already records whether a command comes from a package.json script or a Vite config when it builds the graph. Task loader implementation

For example, a build task that runs vite build produces the same JSON whether it’s declared in package.json or vite.config.ts. To tell the two apart, this PR has to discover workspace packages and read their manifests before and after each graph query. That also means keeping DevTools in sync with the runner’s rules as they evolve.

If the graph included source, DevTools could use it directly and only inspect the selected package when it needs to locate the file or line to open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants