Commit 513b849
Update/positron list focus and selection (#13707)
# PositronList focus & selection + supporting changes
This PR adds focus and selection behavior to `PositronList`, and
includes a handful of supporting improvements to `DataGridInstance`, the
custom context menu, and the Data Connections panel that landed along
the way.
## Selection mode on DataGridInstance
Introduces `selectionMode: 'spreadsheet' | 'list'` as a discriminated
option (rejected at compile time when `selection: false`):
- **`'spreadsheet'`** (default): plain keyboard navigation clears the
selection — cursor and selection are independent. Existing main data
grid and table summary behavior is preserved.
- **`'list'`**: plain keyboard navigation re-selects the cursor row
after the move so single-select tracks the cursor. Shift-navigation
still extends selection regardless of mode.
The waffle's navigation handlers (ArrowUp/Down/Left/Right, Home, End,
Cmd+Home, Cmd+End, PageUp, PageDown) all route through a small
`navigationSelection.{beforeMoveCursor, afterMoveCursor}` helper so the
policy lives in one place.
## PositronList focus & selection
- `PositronListInstance` opts into `selectionMode: 'list'` so plain
arrow navigation moves the row selection together with the cursor.
- Cell-level mouse clicks now route through `mouseSelectRow` so the row
selection bucket (which `getSelectedItems()` and the `.selected` class
read) actually gets populated.
- The default `.focused` row styling is now gated on **both**
cursor-on-row AND grid keyboard focus, mirroring the pattern used by
`ColumnSummaryCell`. The focus ring disappears when focus leaves the
list.
- `PositronListItemContext` exposes `cursor`, `listFocused`, and
`selected` so caller-rendered items can implement custom focus/selection
styling.
- `.positron-list-row` switched from `outline` to a transparent border
with `box-sizing: border-box`, so the focus ring color swap doesn't
reflow content.
## Section row handling
- `PositronList` already had `isRowSelectable` skipping section rows
during keyboard navigation. This branch refines it further:
- `moveCursorUp` now reveals the adjacent unselectable row above the
cursor (just one — not a whole stack).
- New `firstSelectableRowIndex` / `lastSelectableRowIndex` getters on
`DataGridInstance` make Cmd+Home and Cmd+End land on the first/last
*selectable* row, skipping section headers.
## Bug fixes in shift-extend selection
Fixed five truthy-zero bugs in
`extend{Row,Column}Selection{Up,Down,Left,Right}` where `if (!position)`
short-circuited on the valid position `0`. Shift-arrow extension now
works correctly:
- shift-right from column 0
- shift-left when the first selected column is 0
- shift-up when the first selected row is 0
- shift-up from row 0 with no prior selection
- shift-down when the first selected row is 0
## Custom context menu
Refinements stacking on prior work:
- `CustomContextMenuSeparator` accepts an optional title.
- Items support a `destructive` style and an `iconSrc` (e.g., language
icons).
- `checked` and `destructive` are now mutually exclusive at the type
level.
<p>
<img width="185" height="227" alt="image"
src="https://github.com/user-attachments/assets/2b52cabf-7f46-4609-8dcc-14bd60f5db49"
/>
</p>
## Data Connections
- New `dataConnections.enabled` feature flag (hidden from settings UI;
settable via `settings.json`, requires reload) gating the experimental
Data Connections view container/view.
- "No data connections" empty state updated to match the Variables
panel.
- Various small refinements in the panel.
Tests:
@:data-explorer
### Release Notes
#### New Features
- N/A
#### Bug Fixes
- N/A
### Validation Steps
- [ ] Arrow keys move the PositronList cursor and selection together;
shift-arrow extends selection
- [ ] Clicking a list item selects it; shift-click extends; section
headers ignore clicks
- [ ] Focus ring shows only when the list has keyboard focus; disappears
on blur
- [ ] Cmd+Home / Cmd+End land on a selectable row when the first/last
row is a section header
- [ ] Main data grid and table summary keyboard behavior unchanged
(spreadsheet mode preserved)
- [ ] Shift-right/left/up/down from row 0 or column 0 now extends
selection correctly
- [ ] Setting `dataConnections.enabled: true` in `settings.json` shows
the Data Connections view after reload
- [ ] Context menu items render with destructive styling and icons where
configured
---------
Co-authored-by: Brice Stacey <bricestacey@gmail.com>1 parent 27c03df commit 513b849
17 files changed
Lines changed: 418 additions & 154 deletions
File tree
- src/vs
- platform/positronActionBar/browser
- workbench
- browser
- positronComponents/customContextMenu
- positronDataGrid
- classes
- components
- positronList
- classes
- contrib
- positronDataConnections/browser
- components
- positronPackages/browser/components
- services/positronDataConnections/common
Lines changed: 4 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
34 | 34 | | |
35 | | - | |
36 | | - | |
| 35 | + | |
37 | 36 | | |
38 | 37 | | |
39 | | - | |
| 38 | + | |
40 | 39 | | |
41 | | - | |
42 | | - | |
| 40 | + | |
43 | 41 | | |
44 | 42 | | |
45 | 43 | | |
| |||
Lines changed: 29 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
21 | 28 | | |
22 | 29 | | |
23 | 30 | | |
| |||
29 | 36 | | |
30 | 37 | | |
31 | 38 | | |
32 | | - | |
| 39 | + | |
33 | 40 | | |
34 | 41 | | |
35 | 42 | | |
36 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
37 | 48 | | |
38 | 49 | | |
39 | 50 | | |
| |||
42 | 53 | | |
43 | 54 | | |
44 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
45 | 60 | | |
46 | 61 | | |
47 | 62 | | |
| |||
65 | 80 | | |
66 | 81 | | |
67 | 82 | | |
68 | | - | |
69 | | - | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
70 | 92 | | |
71 | 93 | | |
72 | 94 | | |
| |||
76 | 98 | | |
77 | 99 | | |
78 | 100 | | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
| 101 | + | |
84 | 102 | | |
85 | 103 | | |
86 | 104 | | |
| |||
98 | 116 | | |
99 | 117 | | |
100 | 118 | | |
101 | | - | |
| 119 | + | |
| 120 | + | |
102 | 121 | | |
103 | 122 | | |
104 | 123 | | |
Lines changed: 57 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
34 | 36 | | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
40 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
41 | 45 | | |
42 | 46 | | |
43 | 47 | | |
| |||
53 | 57 | | |
54 | 58 | | |
55 | 59 | | |
56 | | - | |
| 60 | + | |
57 | 61 | | |
58 | 62 | | |
59 | 63 | | |
| |||
217 | 221 | | |
218 | 222 | | |
219 | 223 | | |
220 | | - | |
| 224 | + | |
221 | 225 | | |
222 | 226 | | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
229 | 240 | | |
230 | 241 | | |
231 | 242 | | |
| |||
261 | 272 | | |
262 | 273 | | |
263 | 274 | | |
264 | | - | |
| 275 | + | |
| 276 | + | |
265 | 277 | | |
266 | 278 | | |
267 | 279 | | |
| |||
283 | 295 | | |
284 | 296 | | |
285 | 297 | | |
286 | | - | |
287 | | - | |
| 298 | + | |
| 299 | + | |
288 | 300 | | |
289 | 301 | | |
290 | 302 | | |
291 | 303 | | |
292 | | - | |
| 304 | + | |
| 305 | + | |
293 | 306 | | |
294 | 307 | | |
295 | 308 | | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
296 | 321 | | |
297 | 322 | | |
298 | 323 | | |
| |||
434 | 459 | | |
435 | 460 | | |
436 | 461 | | |
437 | | - | |
438 | | - | |
| 462 | + | |
| 463 | + | |
439 | 464 | | |
440 | 465 | | |
441 | 466 | | |
| |||
444 | 469 | | |
445 | 470 | | |
446 | 471 | | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
447 | 483 | | |
448 | 484 | | |
449 | 485 | | |
| |||
502 | 538 | | |
503 | 539 | | |
504 | 540 | | |
505 | | - | |
| 541 | + | |
506 | 542 | | |
507 | 543 | | |
508 | 544 | | |
| |||
Lines changed: 22 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
10 | 12 | | |
11 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
12 | 31 | | |
13 | 32 | | |
14 | 33 | | |
15 | 34 | | |
16 | 35 | | |
17 | | - | |
18 | | - | |
19 | 36 | | |
20 | 37 | | |
21 | 38 | | |
22 | 39 | | |
23 | 40 | | |
24 | 41 | | |
25 | 42 | | |
26 | | - | |
| 43 | + | |
27 | 44 | | |
28 | 45 | | |
29 | 46 | | |
| |||
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
10 | 16 | | |
0 commit comments