Skip to content

fix(devtools): resolve open-in-editor paths against the workspace root - #1165

Open
0froq wants to merge 1 commit into
nuxt:v3from
0froq:fix/v3-open-in-editor-workspace-path
Open

0froq wants to merge 1 commit into
nuxt:v3from
0froq:fix/v3-open-in-editor-workspace-path

Conversation

@0froq

@0froq 0froq commented Nov 17, 2026

Copy link
Copy Markdown

🔗 Linked issue

resolves #1097

📚 Description

Relative inspector paths were only joined with process.cwd(). In a workspace package that directory is the package itself, so src/components/button/Button.demo.vue becomes <repo>/docs/src/components/button/Button.demo.vue and the file is reported missing.

openInEditor now tries process.cwd(), rootDir, and workspaceDir, and opens the first path that exists. The :line:col suffix is stripped before the join. Auth and launch-editor are unchanged.

#1098 already did this on main. Nuxt 4.6 still depends on 3.4.4, so this brings the same lookup to v3.

In packages/devtools, pnpm exec vitest run test/open-in-editor.test.ts test/server-rpc-auth.test.ts. The case opens a file that lives at the workspace root, outside the Nuxt package sends src/components/button/Button.demo.vue:27:2 with cwd at docs/ and expects the file under the workspace root. That case passes on this branch. I did not run the repo lint or typecheck, and I did not boot this build in a running Nuxt app.

The component inspector sends paths relative to the workspace root, but openInEditor only joined them with the package cwd. Files outside that package were reported missing.

Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai

coderabbitai Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

openInEditor now checks relative paths against the current working directory, Nuxt rootDir, and workspaceDir, and checks supported extensions. It removes line and column suffixes before path resolution. Tests cover relative and absolute paths, suffixes, and missing files.

Estimated code review effort: 2 (Simple) | ~10 minutes

Severity of issue fixed: Medium

Merge Risk: Minimal · up to 5c468

Open-in-editor now also finds files at the workspace root, outside the Nuxt package, and the new tests cover these lookups and the missing-file case. No concrete merge-blocking risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: openInEditor now resolves relative paths against the workspace root (with cwd and rootDir candidates). It matches the changeset summary and the PR objectives. The titl…
Description check Passed The description states the bug: relative inspector paths were joined only with process.cwd(), which fails in workspace packages. It explains the fix, which tries cwd, rootDir and workspaceDir and stri…
Linked Issues check Passed The only directly linked issue, #1097, is closed and completed. It is historical context only. No active directly linked targets remain, so no linked-issue coding requirements apply to this pull reque…
Out of Scope Changes check Passed The changes stay within the path resolution logic of openInEditor in packages/devtools/src/server-rpc/general.ts, plus tests in packages/devtools/test/open-in-editor.test.ts. The pull request descript…
Full details: Title check

Explanation

The title names the main change: openInEditor now resolves relative paths against the workspace root (with cwd and rootDir candidates). It matches the changeset summary and the PR objectives. The title is 70 characters, within a concise range, and uses the conventional fix(scope) format.

Full details: Description check

Explanation

The description states the bug: relative inspector paths were joined only with process.cwd(), which fails in workspace packages. It explains the fix, which tries cwd, rootDir and workspaceDir and strips the :line:col suffix. It also lists the test command, the test case, and what was not verified. This matches the openInEditor changes and the new tests.

Full details: Linked Issues check

Explanation

The only directly linked issue, #1097, is closed and completed. It is historical context only. No active directly linked targets remain, so no linked-issue coding requirements apply to this pull request.

Full details: Out of Scope Changes check

Explanation

The changes stay within the path resolution logic of openInEditor in packages/devtools/src/server-rpc/general.ts, plus tests in packages/devtools/test/open-in-editor.test.ts. The pull request description states this purpose. The change strips the :line:col suffix, tries process.cwd(), rootDir and workspaceDir, and reports the first candidate when no file exists. The tests cover these behaviours. The author states that auth and launch-editor are unchanged, and the summary does not contradict this. No unrelated change was found in the reviewed summary. This assessment relies on the AI-generated summary and the PR description; no repository inspection was performed.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 56fb1474-5d8c-4fae-a88e-4b0af5b8fc95
Commits

Reviewing files that changed from the base of the PR and between 2845de8 and 5c46857.

Files selected for processing: 2

  • packages/devtools/src/server-rpc/general.ts
  • packages/devtools/test/open-in-editor.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

This branch has not been deployed

No deployments
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.

1 participant