@devries-cameron20 / t3code Mirror · read-only / commits / 24c842936b
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 25, 17:15 UTC

Use Cursor --goto for file targets with line and column

- detect `:line` and `:line:column` suffixes in open targets - pass `--goto` when launching Cursor so it jumps to the cursor location - add tests covering both line-only and line+column targets

Julius Marminge committed Feb 26, 2026 at 15:46 UTC 24c842936bc2637a9e5aead76d3cfa1030a381c2
2 files changed +31 -1
apps/server/src/open.test.ts
+22
@@ -18,6 +18,28 @@ describe("resolveEditorLaunch", () => {
18 }),
19 );
20
21 + it.effect("uses --goto when cursor target includes line/column suffixes", () =>
22 + Effect.gen(function* () {
23 + const lineOnly = yield* resolveEditorLaunch(
24 + { cwd: "/tmp/workspace/AGENTS.md:48", editor: "cursor" },
25 + "darwin",
26 + );
27 + assert.deepEqual(lineOnly, {
28 + command: "cursor",
29 + args: ["--goto", "/tmp/workspace/AGENTS.md:48"],
30 + });
31 +
32 + const lineAndColumn = yield* resolveEditorLaunch(
33 + { cwd: "/tmp/workspace/src/open.ts:71:5", editor: "cursor" },
34 + "darwin",
35 + );
36 + assert.deepEqual(lineAndColumn, {
37 + command: "cursor",
38 + args: ["--goto", "/tmp/workspace/src/open.ts:71:5"],
39 + });
40 + }),
41 + );
42 +
43 it.effect("maps file-manager editor to OS open commands", () =>
44 Effect.gen(function* () {
45 const launch1 = yield* resolveEditorLaunch(
apps/server/src/open.ts
+9 -1
@@ -30,6 +30,12 @@ interface EditorLaunch {
30 readonly args: ReadonlyArray<string>;
31 }
32
33 +const LINE_COLUMN_SUFFIX_PATTERN = /:\d+(?::\d+)?$/;
34 +
35 +function shouldUseGotoFlag(editorId: EditorId, target: string): boolean {
36 + return editorId === "cursor" && LINE_COLUMN_SUFFIX_PATTERN.test(target);
37 +}
38 +
39 /**
40 * OpenShape - Service API for browser and editor launch actions.
41 */
@@ -66,7 +72,9 @@ export const resolveEditorLaunch = Effect.fnUntraced(function* (
72 }
73
74 if (editorDef.command) {
69 - return { command: editorDef.command, args: [input.cwd] };
75 + return shouldUseGotoFlag(editorDef.id, input.cwd)
76 + ? { command: editorDef.command, args: ["--goto", input.cwd] }
77 + : { command: editorDef.command, args: [input.cwd] };
78 }
79
80 if (editorDef.id !== "file-manager") {