Skip to content

fix: pass IDE workspace separately from rootDir - #579

Merged
zh-lx merged 2 commits into
mainfrom
feat/launch-ide-workspace
Aug 24, 2026
Merged

fix: pass IDE workspace separately from rootDir#579
zh-lx merged 2 commits into
mainfrom
feat/launch-ide-workspace

Conversation

@zh-lx

@zh-lx zh-lx commented Aug 24, 2026

Copy link
Copy Markdown
Owner

Summary

  • upgrade launch-ide to 1.4.9 to support the workspace parameter
  • preserve the existing rootDir: record.envDir behavior
  • pass the code-inspector workspace as workspace, resolved in this order: configured workspace, ProjectRootPath, then bundler root
  • document workspace in Chinese and English
  • cover all workspace fallback branches in tests

Verification

  • pnpm exec vitest run test/core/server/server/create-server.test.ts
  • pnpm --filter @code-inspector/core exec tsc --emitDeclarationOnly false --noEmit

close #577

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Add configurable IDE workspace root with deterministic rootDir fallback

✨ Enhancement 🧪 Tests 🕐 20-40 Minutes

Grey Divider

AI Description

• Add workspace option to control the IDE workspace root passed to launchIDE.
• Resolve rootDir in priority order: workspace → ProjectRootPath (git root) → bundler root.
• Add tests covering all root directory fallback branches, including non-git environments.
Diagram

graph TD
  req(["IDE open HTTP request"]) --> handler["server.handleIDERequest"] --> pick{"Resolve rootDir"}
  pick -->|"workspace"| ws["options.workspace"] --> launch["launchIDE()"]
  pick -->|"ProjectRootPath"| pr["git ProjectRootPath"] --> launch
  pick -->|"record.root"| rr["bundler root"] --> launch

  subgraph Legend
    direction LR
    _req(["Request"]) ~~~ _proc["Process"] ~~~ _dec{"Decision"}
  end
Loading
High-Level Assessment

An explicit workspace option is the simplest and most predictable way to control IDE root resolution (especially for monorepos). The chosen fallback chain (workspace → git root → bundler root) is straightforward and is now covered by tests; no materially better alternative stands out without adding configuration complexity (e.g., custom resolver callbacks).

Files changed (4) +96 / -3

Enhancement (3) +11 / -1
server.tsPrefer workspace/git root/bundler root when passing rootDir to launchIDE +1/-1

Prefer workspace/git root/bundler root when passing rootDir to launchIDE

• Updates IDE launch handling to compute 'rootDir' as 'options.workspace || ProjectRootPath || record?.root' instead of relying on the previous record env directory. This makes the IDE workspace root configurable while preserving deterministic fallbacks.

packages/core/src/server/server.ts

type.tsAdd 'workspace' option to CodeOptions with bilingual docs +5/-0

Add 'workspace' option to CodeOptions with bilingual docs

• Extends 'CodeOptions' with an optional 'workspace' string and documents its fallback behavior in both Chinese and English.

packages/core/src/shared/type.ts

type.d.tsUpdate generated declaration for CodeOptions.workspace +5/-0

Update generated declaration for CodeOptions.workspace

• Mirrors the 'workspace?: string' addition in the published type declarations to keep consumers in sync.

packages/core/types/shared/type.d.ts

Tests (1) +85 / -2
create-server.test.tsAdd tests for workspace and rootDir fallback branches +85/-2

Add tests for workspace and rootDir fallback branches

• Updates the existing launchIDE options test to assert 'workspace' takes precedence. Adds coverage for fallback to 'ProjectRootPath' when workspace is absent and to 'record.root' when git root discovery fails.

test/core/server/server/create-server.test.ts

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can switch off images and animations for a plain-text comment

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@codecov

codecov Bot commented Aug 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (22c8d1e) to head (5292fe0).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #579   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           37        37           
  Lines         7032      7033    +1     
  Branches      1986      1988    +2     
=========================================
+ Hits          7032      7033    +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@zh-lx zh-lx changed the title feat: configure IDE workspace root fix: pass IDE workspace separately from rootDir Aug 24, 2026
@zh-lx
zh-lx merged commit d57cbbf into main Aug 24, 2026
5 checks passed
@zh-lx
zh-lx deleted the feat/launch-ide-workspace branch August 24, 2026 11:15
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.

fix(vite): use Vite root instead of envDir as JetBrains workspace

1 participant