Skip to content

Proposal: Automatically add "npm.scriptRunner": "vp" to VS Code settings during scaffolding #1337

@rmnkot

Description

@rmnkot

Description

I propose that the vp create and vp migrate commands should automatically include "npm.scriptRunner": "vp" in the generated .vscode/settings.json file when the user selects VS Code as their IDE.
Why?
UX: It allows users to run scripts from the VS Code "NPM Scripts" side panel directly using the vp runner without manual configuration.
Performance: Ensures users benefit from Vite+'s optimized task runner and caching out of the box.
Consistency: Aligns the editor experience with the CLI's recommendation to use vp run.

Suggested solution

Modify the project scaffolding and migration logic within the vp CLI to automatically populate .vscode/settings.json.

  1. Implementation Details:
    When a user selects VS Code during the vp create or vp migrate process (or uses the --editor vscode flag), the CLI should ensure the following entry is added to the generated settings file:
{
  "npm.scriptRunner": "vp"
}
  1. Affected Components:
    Template Generator: Update the default VS Code configuration templates in packages/create-vp (or the equivalent scaffolding package) to include this property.
    Migration Tool: Update the vp migrate command to append this setting if .vscode/settings.json already exists, or create it if it doesn't.
  2. Behavior:
    If the file exists, the CLI should perform a deep merge to avoid overwriting user-defined settings.
    The change should be documented as a recommended "best practice" for using Vite+ with VS Code to ensure scripts (dev, build, test) leverage the vp task runner and its caching capabilities directly from the IDE interface.

Users will be able to click 'Run' or 'Debug' icons next to scripts in the VS Code explorer, and it will execute via vp run [script] instead of the default npm/pnpm/yarn, providing immediate performance benefits without manual setup.

Alternative

No response

Additional context

No response

Validations

  • Read the Contributing Guidelines.
  • Confirm this request is for Vite+ itself and not for Vite, Vitest, tsdown, Rolldown, or Oxc.
  • Check that there isn't already an issue requesting the same feature.

Metadata

Metadata

Assignees

Priority

None yet

Start date

None yet

Target date

None yet

Effort

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions