fix(vite): use Vite root instead of envDir as JetBrains workspace
Reproduction
- Configure Vite with
envDir: "./env". - Enable
codeInspectorPlugin({ editor: "webstorm", bundler: "vite" }). - Trigger Code Inspector on a DOM element.
Actual behavior
WebStorm opens <project-root>/env as the project/workspace.
Expected behavior
WebStorm should open the Vite project root while still loading environment files from envDir.
Root cause
In the Vite adapter, configResolved stores both config.envDir and config.root. The core click handler currently passes record.envDir to launchIDE as rootDir. launch-ide prioritizes this value as the JetBrains workspace, so a custom Vite envDir becomes the opened project directory.
This is still present on master:
record.envDir = config.envDir || config.root
record.root = config.root
Proposed fix
Use the already recorded Vite root when launching the IDE:
- rootDir: record?.envDir,
+ rootDir: record?.root,
This keeps envDir semantics intact and makes JetBrains IDEs open the actual Vite project root.
Tested locally with @code-inspector/[email protected] and [email protected].
Thanks for your feedback, resolved by #579