Skip to content

Commit 7d69cf5

Browse files
fix(contracts): keep the current default editor when Devin is installed
Without a saved choice the first available entry in EDITORS is the default. Listing Devin last means it only becomes the default where the file manager was.
1 parent dafa0e2 commit 7d69cf5

2 files changed

Lines changed: 24 additions & 2 deletions

File tree

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { beforeEach, describe, expect, it } from "vite-plus/test";
2+
3+
import { resolveAndPersistPreferredEditor } from "./editorPreferences";
4+
import { removeLocalStorageItem } from "./hooks/useLocalStorage";
5+
6+
describe("resolveAndPersistPreferredEditor", () => {
7+
beforeEach(() => {
8+
removeLocalStorageItem("t3code:last-editor");
9+
});
10+
11+
it("keeps an established editor as the default when Devin is also installed", () => {
12+
expect(resolveAndPersistPreferredEditor(["devin", "webstorm", "file-manager"])).toBe(
13+
"webstorm",
14+
);
15+
});
16+
17+
it("defaults to Devin over the file manager", () => {
18+
expect(resolveAndPersistPreferredEditor(["file-manager", "devin"])).toBe("devin");
19+
});
20+
});

‎packages/contracts/src/editor.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ export const EDITORS = [
3131
},
3232
{ id: "trae", label: "Trae", commands: ["trae"], launchStyle: "goto" },
3333
{ id: "kiro", label: "Kiro", commands: ["kiro"], baseArgs: ["ide"], launchStyle: "goto" },
34-
// Devin Desktop was Windsurf. Installs from before the rename only have `windsurf`.
35-
{ id: "devin", label: "Devin", commands: ["devin-desktop", "windsurf"], launchStyle: "goto" },
3634
{
3735
id: "vscode",
3836
label: "VS Code",
@@ -81,6 +79,10 @@ export const EDITORS = [
8179
{ id: "rubymine", label: "RubyMine", commands: ["rubymine"], launchStyle: "line-column" },
8280
{ id: "rustrover", label: "RustRover", commands: ["rustrover"], launchStyle: "line-column" },
8381
{ id: "webstorm", label: "WebStorm", commands: ["webstorm"], launchStyle: "line-column" },
82+
// Devin Desktop was Windsurf. Installs from before the rename only have `windsurf`.
83+
// Without a saved choice the first available editor here is the default, so newer
84+
// entries go last to keep existing users on the editor they already get.
85+
{ id: "devin", label: "Devin", commands: ["devin-desktop", "windsurf"], launchStyle: "goto" },
8486
{ id: "file-manager", label: "File Manager", commands: null, launchStyle: "direct-path" },
8587
] as const satisfies ReadonlyArray<EditorDefinition>;
8688

0 commit comments

Comments
 (0)