Commit 11507bb
authored
Code tab: right-click
**The Code tab's right-click menu gains an `Open <path>:<line>` entry.**
Reviewing a diff and wanting the full file at the same line was
previously two steps — copy `path:N`, switch to browse mode,
paste-navigate. Now it's one click; the menu item dispatches through the
same pipeline a terminal-link click does.
This is **Phase 0 of #881's redo** — small user-visible win on top of a
seam Phase 1 (line-anchored comments) will reuse. The structural review
behind the redo is in #881's body and replaces #879.
### Before / after
```
Diff view: alpha
beta ← right-click line 2
gamma
Before: [Copy path] [Copy notes.txt:2]
After: [Copy path] [Copy notes.txt:2] [Open notes.txt:2]
└──┐
one click ▼
browse mode, file open, line 2 highlighted
```
### The seam
The terminal-link click pipeline used to require a **paired write** at
every call site:
```ts
// Terminal.tsx (before)
rightPanel.openCodeBrowser(); // ① uncollapse + tab + browse-mode
requestCodeOpen({ ref, repoRoot, cwd, targetMode: "browse" }); // ② pending
// Comment: "must fire in the same DOM-event tick or resetKey clears
// what pendingCodeOpen is about to set."
```
The ordering hazard sat at the call site as documented discipline, which
meant every new producer (right-click _Open_, future _Comment on_)
inherited the same wall-of-text rationale. Phase 0 collapses both writes
into one function:
```ts
// Terminal.tsx (after)
openInCodeTab({ ref, repoRoot, cwd, targetMode: "browse" });
```
`openInCodeTab` (replacing `codeNavigation.ts`) encapsulates both
writes; `useRightPanel.openCodeBrowser()` is generalized to
`openCodeAt(mode: CodeTabView)` so a Phase 1 comment authored while
reviewing a diff can re-open in that diff mode rather than always
browse.
### What landed
| Layer | Change |
| --- | --- |
| Producer-facing | `openInCodeTab(req)` — single call replaces the
paired-write pattern at every site |
| Panel state | `useRightPanel.openCodeAt(mode)` — atomic three-field
preferences patch parameterized on the target sub-mode; skips the patch
when already at target |
| Menu data | `CodeContextMenuItem` becomes a discriminated union
(`kind: "copy"` vs `kind: "action"`); `handleItem` dispatches via
`ts-pattern.exhaustive()` |
| Selection hook | `useLineSelection` gains `onOpen?: Accessor<((ref) =>
void) \| undefined>`; when present and a range is selected, an _Open
path:N_ action item is emitted |
| Code tab wiring | The diff-view `CodeMenuFrame` passes `onOpen` that
routes through `openInCodeTab`. The browse-view path deliberately omits
it — the file is already on screen at line precision |
_The `Accessor<…>` shape on `onOpen` mirrors `initialRange` — buildItems
runs at menu-open time, so a host whose prop arrives late in the SolidJS
lifecycle still flips the item in._
### Test coverage
- `code-tab.feature` — new scenario: right-click in diff view, click
_Open notes.txt:2_, assert mode flipped to browse + file selected + line
2 highlighted
- `code-tab.feature` — updated multi-file diff scenario to assert the
three-item menu (`Copy path | Copy file-b.txt:1 | Open file-b.txt:1`)
- `file-ref-link.feature` — terminal-link clicks now flow through
`openInCodeTab`; all three pre-existing scenarios still pass
43/43 scenarios, 503/503 steps locally.
### Try it locally
```sh
nix run github:juspay/kolu/open-in-code-tab
```
_Generated by [`/do`](https://github.com/srid/agency) on Claude Code
(model `claude-opus-4-7`)._Open path:N jumps to file at that line (#891)1 parent 3e7623b commit 11507bb
14 files changed
Lines changed: 422 additions & 162 deletions
File tree
- packages
- client/src
- right-panel
- terminal
- ui
- solid-pierre/src
- tests
- features
- step_definitions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
28 | 34 | | |
29 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
30 | 53 | | |
31 | 54 | | |
32 | 55 | | |
33 | 56 | | |
| 57 | + | |
34 | 58 | | |
35 | 59 | | |
36 | 60 | | |
37 | 61 | | |
38 | 62 | | |
39 | 63 | | |
40 | | - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
41 | 80 | | |
42 | 81 | | |
43 | 82 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
45 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
46 | 50 | | |
47 | 51 | | |
48 | 52 | | |
| |||
176 | 180 | | |
177 | 181 | | |
178 | 182 | | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
179 | 205 | | |
180 | 206 | | |
181 | 207 | | |
182 | 208 | | |
183 | 209 | | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
| 210 | + | |
199 | 211 | | |
200 | 212 | | |
201 | 213 | | |
202 | 214 | | |
203 | 215 | | |
204 | 216 | | |
205 | | - | |
206 | | - | |
207 | | - | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
208 | 220 | | |
209 | 221 | | |
210 | 222 | | |
211 | 223 | | |
212 | 224 | | |
213 | 225 | | |
214 | | - | |
| 226 | + | |
215 | 227 | | |
216 | 228 | | |
217 | 229 | | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
224 | 237 | | |
225 | 238 | | |
226 | 239 | | |
227 | 240 | | |
228 | 241 | | |
229 | | - | |
| 242 | + | |
230 | 243 | | |
231 | 244 | | |
232 | 245 | | |
| |||
263 | 276 | | |
264 | 277 | | |
265 | 278 | | |
266 | | - | |
| 279 | + | |
267 | 280 | | |
268 | 281 | | |
269 | 282 | | |
| |||
275 | 288 | | |
276 | 289 | | |
277 | 290 | | |
278 | | - | |
| 291 | + | |
279 | 292 | | |
280 | 293 | | |
281 | 294 | | |
| |||
538 | 551 | | |
539 | 552 | | |
540 | 553 | | |
541 | | - | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
542 | 567 | | |
543 | 568 | | |
544 | 569 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
| |||
39 | 41 | | |
40 | 42 | | |
41 | 43 | | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | 44 | | |
58 | 45 | | |
59 | 46 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
50 | 57 | | |
51 | 58 | | |
52 | 59 | | |
53 | 60 | | |
54 | | - | |
| 61 | + | |
55 | 62 | | |
56 | | - | |
| 63 | + | |
| 64 | + | |
57 | 65 | | |
58 | 66 | | |
59 | 67 | | |
| |||
0 commit comments