fix(ide): add set IDE command#450
Conversation
The desktop Start button passed no --ide flag to `devsy up`, so the CLI fell back to the persisted workspace IDE in workspace.json. Switching the dropdown after the workspace had already been created with a different IDE had no effect — the old IDE launched anyway. - Pass the current dropdown selection from handleStart to workspaceUp alongside the workspace folder. - Add `devsy ide set <workspace> <ide>` which persists the IDE via ideparse.RefreshIDEOptions without spinning up the container. - Wire the desktop IDE dropdown's onSelect to call the new command so the selection persists immediately. Roll back the UI state on failure and skip the call for the "none" sentinel.
✅ Deploy Preview for devsydev canceled.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughAdds an ChangesIDE Set Command: Backend to Frontend
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add 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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@cmd/ide/set.go`:
- Around line 66-69: Update the IDE-setting flow in cmd/ide/set.go to accept an
explicit "clear" sentinel (e.g., "none" or "unset") by checking ideName after
lowercasing and, if it matches the sentinel, clear the workspace IDE config and
persist that empty/unset state instead of calling ideparse.GetIDEOptions;
otherwise continue to validate via ideparse.GetIDEOptions(ideName) as before.
Use the existing variables (ideName) and the code path that writes the workspace
config to save the cleared state and return success.
In `@desktop/src/renderer/src/pages/WorkspaceDetailPage.svelte`:
- Around line 556-567: The current onSelect handler may revert selectedIde to an
outdated value when IDE-change requests complete out of order; wrap the async
call with a version/token check so only the latest in-flight request can mutate
UI state: add a module-level or component-level counter (e.g.,
ideSelectionVersion), increment it before starting the async workspaceSetIde
call, capture the current version in a local const (e.g., const myVersion =
++ideSelectionVersion), and in the catch/after-await paths only perform
selectedIde = prev (or any state apply/rollback) if myVersion ===
ideSelectionVersion; alternatively use an AbortController and cancel previous
requests if workspaceSetIde supports cancellation. Reference symbols:
selectedIde, ide.value, prev, workspaceSetIde, ideComboOpen, ideSearch, and
introduce ideSelectionVersion (or AbortController) to gate rollbacks.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 69fdf189-5852-4f50-908a-7f7264819948
📒 Files selected for processing (5)
cmd/ide/ide.gocmd/ide/set.godesktop/src/main/ipc.tsdesktop/src/renderer/src/lib/ipc/commands.tsdesktop/src/renderer/src/pages/WorkspaceDetailPage.svelte
| ideName = strings.ToLower(ideName) | ||
| if _, err := ideparse.GetIDEOptions(ideName); err != nil { | ||
| return err | ||
| } |
There was a problem hiding this comment.
Add an explicit “clear IDE” path instead of rejecting non-IDE sentinels.
Right now this flow only accepts recognized IDE names. That blocks persisting a “no IDE” selection for existing workspaces, so stale workspace IDE config can remain active in later starts when --ide is omitted. Please support an explicit unset value (e.g., none) or a dedicated unset command and persist that state.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@cmd/ide/set.go` around lines 66 - 69, Update the IDE-setting flow in
cmd/ide/set.go to accept an explicit "clear" sentinel (e.g., "none" or "unset")
by checking ideName after lowercasing and, if it matches the sentinel, clear the
workspace IDE config and persist that empty/unset state instead of calling
ideparse.GetIDEOptions; otherwise continue to validate via
ideparse.GetIDEOptions(ideName) as before. Use the existing variables (ideName)
and the code path that writes the workspace config to save the cleared state and
return success.
Selecting "None" in the desktop IDE dropdown (or wizard) now persists IDE.Name="none" via 'devsy ide set', so the choice survives stop/start. Previously the renderer coerced "none" to undefined before reaching the CLI, which fell through to detect() and launched an IDE anyway. - Stop coercing "none" -> undefined in handleStart, handleOpenIde, and the wizard's workspaceUp call. - Stop early-returning on "none" in the dropdown onSelect so the choice is persisted like any other IDE. - Guard opener.Open with an IDENone short-circuit; container-side installIDE already returned nil for IDENone, but the host-side opener would have fallen into openDesktopIDE.
Summary
When the desktop app's Start button was clicked, the CLI received no
--ideflag and fell back to the IDE persisted inworkspace.json. Switching the dropdown after the workspace had been created with a different IDE had no effect — the old IDE launched anyway (e.g. browser VSCode kept opening after switching to desktop VSCode).handleStart()now forwards the current dropdown IDE (and workspace folder) toworkspaceUp, matchinghandleOpenIde().devsy ide set <workspace> <ide>persists the IDE viaideparse.RefreshIDEOptionswithout starting the container. Lives next todevsy ide use(which is global-default only).onSelectcalls the new command so the selection persists immediately, rolls back UI state on failure, and skips the call for the"none"sentinel (not a real IDE).Summary by CodeRabbit