fix: default empty workspace to open the projects root folder - #798
fix: default empty workspace to open the projects root folder#798achdmbp wants to merge 1 commit into
Conversation
When a workspace has no projects, dependentProjects or starterProjects (for example the dashboard's built-in "Empty Workspace" sample), the launcher generated a `.code-workspace` file with no `folders` array. As a result the editor opened with an empty Explorer and nothing mounted, even though PROJECTS_ROOT exists and is where the user is expected to work. Fix: after synchronizing devfile projects, if the workspace still has no folders, default `folders` to a single entry pointing at PROJECTS_ROOT. This is a no-op for workspaces that already resolve folders (single-project, multi-repo, or a VSCODE_DEFAULT_WORKSPACE file that already lists folders). Adds a unit test and an empty devworkspace fixture covering the no-project case. Fixes: eclipse-che/che#23938 Signed-off-by: Adnan Al <98621989+achdmbp@users.noreply.github.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthrough
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This change makes empty workspaces open with the projects root visible in the Explorer while preserving existing folder behavior. No actionable merge-blocking risk remains beyond normal checks and review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Full details: Rebase Rules For Upstream ChangesExplanation The pull request changes only three files under ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
What does this PR do?
Ensures an empty workspace always opens with the
PROJECTS_ROOTdirectory mounted in the Explorer.Previously, when a workspace had no
projects,dependentProjects, orstarterProjects(for example the dashboard's built-in "Empty Workspace" sample, whose devfile is justschemaVersion+generateName: empty), the launcher'sCodeWorkspace.generate()produced a.code-workspacefile with nofoldersarray:{ "extensions": { "recommendations": ["..."] } }VS Code / che-code then opens this as a multi-root workspace with zero folders, so the Explorer is empty and nothing is mounted, even though
/projectsexists and is where the user is expected to work.The fix adds a small fallback in
generate(): after synchronizing devfile projects, iffoldersis still empty or absent, it defaults to a single entry pointing atPROJECTS_ROOT:This is a no-op for workspaces that already resolve folders (single-project, multi-repo, or a
VSCODE_DEFAULT_WORKSPACEfile that already lists folders), so existing behavior is unchanged.What issues does this PR fix?
Fixes eclipse-che/che#23938
How to test this PR?
/projects(PROJECTS_ROOT) folder mounted instead of opening empty.cat /projects/.code-workspace— it should contain afoldersentry for the projects root alongside the extension recommendations.Automated coverage: a new unit test (
should add PROJECTS_ROOT as a default folder when the workspace has no projects) and an empty devworkspace fixture were added. The full launcher build (npm install→ format +tsc+ eslint + jest) passes with all 66 tests green.Does this PR contain changes that override default upstream Code-OSS behavior?
git rebasewere added to the .rebase folderNote: this change is entirely within
launcher/and does not touch thecode/folder, so the CHANGELOG.md /.rebaseitems above do not apply.Summary by CodeRabbit
Bug Fixes
projectsfolder based on the configured projects location.Tests