Skip to content

fix(ide): add set IDE command#450

Merged
skevetter merged 4 commits into
mainfrom
fix/workspace-ide-selection-ignored
May 27, 2026
Merged

fix(ide): add set IDE command#450
skevetter merged 4 commits into
mainfrom
fix/workspace-ide-selection-ignored

Conversation

@skevetter

@skevetter skevetter commented May 27, 2026

Copy link
Copy Markdown
Contributor

Summary

When the desktop app's Start button was clicked, the CLI received no --ide flag and fell back to the IDE persisted in workspace.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) to workspaceUp, matching handleOpenIde().
  • New CLI command devsy ide set <workspace> <ide> persists the IDE via ideparse.RefreshIDEOptions without starting the container. Lives next to devsy ide use (which is global-default only).
  • Desktop dropdown onSelect calls 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

  • New Features
    • Configure and change IDE for individual workspaces from the workspace details page.
    • CLI support for managing and workspace IDE settings.
  • Behavioral Changes
    • IDE preference is included when starting or creating workspaces so starts respect configured IDE and folder.
    • "Open IDE" is disabled when no IDE is selected.
  • Reliability
    • IDE selection shows errors on failure and restores prior selection to avoid inconsistent UI states.

Review Change Stack

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.
@netlify

netlify Bot commented May 27, 2026

Copy link
Copy Markdown

Deploy Preview for devsydev canceled.

Name Link
🔨 Latest commit a831635
🔍 Latest deploy log https://app.netlify.com/projects/devsydev/deploys/6a17678cd0a6b6000796d7b9

@coderabbitai

coderabbitai Bot commented May 27, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: dbfed472-46e1-4a94-b8b1-ca5a905a8915

📥 Commits

Reviewing files that changed from the base of the PR and between 5a4d1d7 and a831635.

📒 Files selected for processing (3)
  • desktop/src/renderer/src/lib/components/workspace/WorkspaceWizard.svelte
  • desktop/src/renderer/src/pages/WorkspaceDetailPage.svelte
  • pkg/ide/opener/opener.go

📝 Walkthrough

Walkthrough

Adds an ide set CLI command, an Electron IPC handler that calls it (with analytics), frontend wiring to invoke that IPC from the IDE picker with async rollback and sequencing protection, and an IDE-opener no-op when the IDE is "none".

Changes

IDE Set Command: Backend to Frontend

Layer / File(s) Summary
CLI Command Implementation
cmd/ide/ide.go, cmd/ide/set.go
NewSetCmd registers and implements ide set [workspace] [ide] with --option/-o support, validates workspace and IDE, normalizes IDE name to lowercase, and persists configuration via ideparse.RefreshIDEOptions.
Electron IPC Handler
desktop/src/main/ipc.ts
Adds workspace_set_ide IPC handler that logs an analytics event and invokes the CLI command to persist the IDE choice.
Frontend IDE Selection and Start Flow
desktop/src/renderer/src/lib/ipc/commands.ts, desktop/src/renderer/src/pages/WorkspaceDetailPage.svelte, desktop/src/renderer/src/lib/components/workspace/WorkspaceWizard.svelte
Exports workspaceSetIde IPC wrapper and integrates it into the IDE picker onSelect flow with async persistence, rollback on failure, and an ideSetSeq guard; workspaceUp calls now include ide and workspaceFolder in payloads; "Open IDE" is disabled when currentIde === "none".
IDE Opener Short-circuit
pkg/ide/opener/opener.go
Open now returns immediately (empty URL, nil error) when ideName equals config.IDENone.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding a new devsy ide set command to set workspace-specific IDE configurations, which is the core feature introduced across multiple files in this changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ 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

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 skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


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

Comment @coderabbitai help to get the list of available commands and usage tips.

@skevetter skevetter changed the title fix(ide): honor freshly selected IDE on workspace start fix(ide): add set IDE command May 27, 2026
@skevetter
skevetter marked this pull request as ready for review May 27, 2026 21:29

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 33fed3a and 5a4d1d7.

📒 Files selected for processing (5)
  • cmd/ide/ide.go
  • cmd/ide/set.go
  • desktop/src/main/ipc.ts
  • desktop/src/renderer/src/lib/ipc/commands.ts
  • desktop/src/renderer/src/pages/WorkspaceDetailPage.svelte

Comment thread cmd/ide/set.go
Comment on lines +66 to +69
ideName = strings.ToLower(ideName)
if _, err := ideparse.GetIDEOptions(ideName); err != nil {
return err
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

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.

Comment thread desktop/src/renderer/src/pages/WorkspaceDetailPage.svelte
@skevetter
skevetter marked this pull request as draft May 27, 2026 21:36
skevetter added 3 commits May 27, 2026 16:37
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.
@skevetter
skevetter marked this pull request as ready for review May 27, 2026 22:40
@skevetter
skevetter merged commit d928f99 into main May 27, 2026
106 of 110 checks passed
@skevetter
skevetter deleted the fix/workspace-ide-selection-ignored branch May 27, 2026 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant