dsh-sidebar-row-menu 1.5.1 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +63 -0
- package/README.en.md +45 -26
- package/README.md +32 -19
- package/lib/client.js +97 -61
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,68 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.6.0 — 2026-11-05
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- **Workspace entries can opt into the native "…" menu on DSH 0.2.2.** The
|
|
8
|
+
workspace-row entries (New session, pinned app, Open with, Copy workspace path,
|
|
9
|
+
Open in new tab, Delete workspace and all sessions) are now right-click only by
|
|
10
|
+
default, matching the session rows: a provider answers only while a right-click
|
|
11
|
+
gesture is active. Enabling the matching switch under Settings → "Also show in the
|
|
12
|
+
"…" menu → workspace" makes it skip that check, so the entry also lands in the
|
|
13
|
+
host's "…" menu.
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
- **"Open with" keeps its icon on DSH 0.2.2.** The entry is contributed to the
|
|
18
|
+
host menu as data, so it had no icon of its own; it now registers an
|
|
19
|
+
`contextMenu.icon` slot (`sidebar-row-menu.open-with`) and points the action at
|
|
20
|
+
it, matching the self-drawn 0.2.1 menu.
|
|
21
|
+
- **Menu separators stay visible at 125–150% display scaling.** The host draws
|
|
22
|
+
0.5px hairlines; at fractional device pixel ratios one of them was painted as a
|
|
23
|
+
~0.4px smear and read as missing. A `min-resolution: 1.2dppx` media query now
|
|
24
|
+
thickens menu separators (and the 0.2.1 `.dsrm-sep`) to 1px in that range, and
|
|
25
|
+
leaves 1x and 2x displays untouched.
|
|
26
|
+
- **The workspace menu follows the session menu's grouping.** On 0.2.2 the entries
|
|
27
|
+
were interleaved as right-click group → pinned/open-with → copy path, so the
|
|
28
|
+
separator before "Open with" landed in a different place than in the session
|
|
29
|
+
menu. The workspace providers now use the session order — row actions, then
|
|
30
|
+
Copy path/Reveal, then the open-with group, then Delete — so both menus split
|
|
31
|
+
into the same three blocks.
|
|
32
|
+
- **"Open with" shows its submenu affordance again.** Host menu items draw no
|
|
33
|
+
caret for submenu parents. The action's label is rendered by the host as an
|
|
34
|
+
element, so the workspace entry now passes a label that lays the text out with
|
|
35
|
+
a right-aligned chevron, matching the session menu's arrow instead of a "›"
|
|
36
|
+
glued to the text (the 0.2.1 self-drawn menu keeps its own arrow icon).
|
|
37
|
+
|
|
38
|
+
### Changed
|
|
39
|
+
|
|
40
|
+
- **The workspace-row switches are no longer hidden on 0.2.2.** The section note now
|
|
41
|
+
explains that 0.2.2 shares one host menu between right-click and the `…` button
|
|
42
|
+
while the plugin's entries still follow the gesture, and that the switches opt
|
|
43
|
+
individual entries into that shared menu. This reverses the 1.5.0 decision to hide
|
|
44
|
+
the group.
|
|
45
|
+
|
|
46
|
+
### 中文摘要
|
|
47
|
+
|
|
48
|
+
- **0.2.2 上工作区条目默认只出现在右键菜单**:工作区 provider 解析时检查同一枚
|
|
49
|
+
右键手势标记,行尾「…」的 `pointerdown` 会先清标,所以「…」菜单保持原生内容。
|
|
50
|
+
- **工作区行可以在设置里「同时放进「…」菜单」**:逐项开启后 provider 跳过手势判断,
|
|
51
|
+
对应条目也会进入宿主的「…」菜单;0.2.2 上这组开关不再隐藏,说明文字改成描述
|
|
52
|
+
共用菜单 + 手势区分的真实行为。0.2.1 仍由插件接管「…」按钮自绘。
|
|
53
|
+
- **0.2.2 的「打开方式」恢复图标**:数据贡献的条目本身没有图标,现在注册
|
|
54
|
+
`contextMenu.icon`(`sidebar-row-menu.open-with`)并由动作引用,与 0.2.1 自绘
|
|
55
|
+
菜单一致。
|
|
56
|
+
- **125%–150% 缩放下菜单分隔线可见**:宿主用的是 0.5px 细线,在分数像素比下会被
|
|
57
|
+
摊成约 0.4px 而像「消失」;现在该区间内分隔线(含 0.2.1 的 `.dsrm-sep`)补到
|
|
58
|
+
1px,1x 与 2x 显示不变。
|
|
59
|
+
- **工作区菜单改用会话菜单的分组规则**:原来「打开方式」组夹在复制路径之前,分隔线
|
|
60
|
+
落点与会话菜单不一致;现在顺序为行内动作 → 复制路径/在文件夹显示 → 打开方式组 →
|
|
61
|
+
删除,两份菜单都分成同样三块。
|
|
62
|
+
- **「打开方式」恢复子菜单箭头**:宿主不给子菜单父项画箭头,但 label 是当元素渲染的,
|
|
63
|
+
所以工作区条目改成「文字 + 右对齐箭头」的 label,与会话菜单的箭头位置一致(不再是
|
|
64
|
+
贴在文字后面的「›」);0.2.1 自绘菜单仍用自己的箭头图标。
|
|
65
|
+
|
|
3
66
|
## 1.5.1 — 2026-11-05
|
|
4
67
|
|
|
5
68
|
### Fixed
|
package/README.en.md
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
Right-click menus for the sidebar of [DeepSeek Harness](https://github.com/deepseek-ai) (DSH):
|
|
11
11
|
|
|
12
12
|
- **Workspace rows** — right-click opens a menu (since DSH 0.2.2 it is part of the
|
|
13
|
-
host's native menu,
|
|
13
|
+
host's native menu, with the plugin's items interleaved by `order`);
|
|
14
14
|
- **Session rows nested under a workspace** — right-click opens that row's own menu
|
|
15
15
|
at the pointer, with the plugin's own entries appended.
|
|
16
16
|
|
|
@@ -27,8 +27,10 @@ Session menu content comes from the `sidebar.workspaces.session.menu.item` slot
|
|
|
27
27
|
built-in actions and other plugins' actions are all there. This plugin only appends
|
|
28
28
|
its own entries; it does not copy or hardcode any built-in action.
|
|
29
29
|
|
|
30
|
-
> The "…" button menu stays exactly as DSH ships it. The plugin's
|
|
31
|
-
>
|
|
30
|
+
> The "…" button menu stays exactly as DSH ships it. The plugin's entries appear
|
|
31
|
+
> only when the menu is opened by right-click — on 0.2.2 that holds for workspace
|
|
32
|
+
> and session rows alike, and each entry can be opted into the "…" menu in Settings.
|
|
33
|
+
> On 0.2.2 both gestures share
|
|
32
34
|
> one host menu, so the plugin tells them apart by the gesture itself: a right-click
|
|
33
35
|
> sets a mark that is released once the menu panel has actually mounted, while the
|
|
34
36
|
> pointerdown on the "…" button clears it immediately. A right-click menu does not
|
|
@@ -40,20 +42,23 @@ its own entries; it does not copy or hardcode any built-in action.
|
|
|
40
42
|
### Workspace row
|
|
41
43
|
|
|
42
44
|
On 0.2.2 the host renders this menu, and the plugin's items interleave with the
|
|
43
|
-
built-in Rename (100), Reveal in file manager (200) and Delete workspace (300)
|
|
44
|
-
|
|
45
|
-
tab
|
|
46
|
-
|
|
45
|
+
built-in Rename (100), Reveal in file manager (200) and Delete workspace (300),
|
|
46
|
+
using the same grouping rules as the session menu: New session 90, Open in new
|
|
47
|
+
tab 110, Copy workspace path 150, pinned app 210, Open with 220, Delete workspace
|
|
48
|
+
and all sessions 310. These items are right-click only by default; the row's "…"
|
|
49
|
+
menu keeps its native content unless you opt entries in under Settings → "Also
|
|
50
|
+
show in the "…" menu → workspace". On 0.2.1 the plugin draws the whole menu and
|
|
51
|
+
runs the official dialogs for Rename and Delete workspace.
|
|
47
52
|
|
|
48
53
|
| Item | Behavior |
|
|
49
54
|
| --- | --- |
|
|
50
55
|
| New session | Expands the workspace and starts a session (same as the row's `+`) |
|
|
51
56
|
| Rename (built-in) | Opens the official "Rename workspace" dialog; on 0.2.1 the plugin renders this item itself |
|
|
52
|
-
| Pinned open-with app | A pinned app shows directly at the top level (e.g. "Open with Visual Studio Code") and opens the workspace directory |
|
|
53
|
-
| Open with | A submenu of external apps (editors, terminals, file managers) sharing the session menu's catalog, pinning and toggles; hover expands it |
|
|
54
|
-
| Reveal in file manager (built-in) | Opens the workspace directory in Explorer; provided by the host on 0.2.2, absent on 0.2.1 |
|
|
55
|
-
| Copy workspace path | Copies the directory path |
|
|
56
57
|
| Open in new tab | Only when `dsh-project-tabs` (exposing `openWorkspaceInTab`) is installed |
|
|
58
|
+
| Copy workspace path | Copies the directory path |
|
|
59
|
+
| Reveal in file manager (built-in) | Opens the workspace directory in Explorer; provided by the host on 0.2.2, absent on 0.2.1 |
|
|
60
|
+
| Pinned open-with app | A pinned app shows directly at the top level (e.g. "Open with Visual Studio Code") and opens the workspace directory |
|
|
61
|
+
| Open with | A submenu of external apps (editors, terminals, file managers) sharing the session menu's catalog, pinning and toggles; hover expands it. Host menu items draw no submenu caret, so the plugin renders the label as text plus a right-aligned chevron, matching the session menu; the 0.2.1 self-drawn menu uses an arrow icon |
|
|
57
62
|
| Delete workspace (built-in) | Opens the official delete confirmation; removes only the workspace registration and leaves its sessions under "Ungrouped". On 0.2.1 the plugin renders this item itself |
|
|
58
63
|
| Delete workspace and all sessions | Permanently deletes every session and transcript under the workspace first, then the workspace registration. If any session fails, the workspace is kept so the user can retry. The directory itself is not deleted |
|
|
59
64
|
|
|
@@ -93,12 +98,17 @@ button clears it at once. While the mark is live the entries render normally;
|
|
|
93
98
|
otherwise they render `null`.
|
|
94
99
|
|
|
95
100
|
To use them from the row's "…" button, enable them one by one under Settings →
|
|
96
|
-
"Row menu" → "Also show in the "…" menu"
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
101
|
+
"Row menu" → "Also show in the "…" menu":
|
|
102
|
+
|
|
103
|
+
- session entries mount into the native "…" menu;
|
|
104
|
+
- workspace entries on 0.2.2: the host menu is data-driven, so an enabled entry skips
|
|
105
|
+
the gesture check and appears in the "…" menu; with everything off that menu keeps
|
|
106
|
+
only the native items;
|
|
107
|
+
- workspace entries on 0.2.1: enabling any of them makes this plugin take over the
|
|
108
|
+
row's "…" button and render the official "Rename / Delete workspace" items
|
|
109
|
+
alongside the enabled plugin entries.
|
|
110
|
+
|
|
111
|
+
With everything off, the "…" button behaves exactly like DSH's own.
|
|
102
112
|
|
|
103
113
|
Blank draft sessions have no right-click menu and are left alone. Rows that are
|
|
104
114
|
neither a workspace nor a session (e.g. "Show more") are not intercepted.
|
|
@@ -114,16 +124,16 @@ Settings → "Row menu" toggles every new entry:
|
|
|
114
124
|
| Delete session | Hides the single-session delete entry in session menus |
|
|
115
125
|
| Allow deleting unarchived sessions | Off by default; also shows "Delete session permanently" on unarchived rows. Requires the previous switch |
|
|
116
126
|
| Delete all archived sessions | Hides the bulk-delete entry |
|
|
117
|
-
| Also show in the "…" menu → workspace
|
|
127
|
+
| Also show in the "…" menu → workspace | Adds workspace right-click entries one by one to the row's "…" menu: New session, Open with, Copy workspace path, Open in new tab, Delete workspace and all sessions. On 0.2.1 enabling any of them makes this plugin render the "…" menu |
|
|
118
128
|
| Also show in the "…" menu → session | Adds session right-click entries one by one to the native "…" menu: Open with, Delete session, Delete all archived sessions |
|
|
119
129
|
|
|
120
130
|
The "Also show in the "…" menu" switches are all off by default; until one is
|
|
121
131
|
enabled the "…" menu is exactly DSH's own.
|
|
122
132
|
|
|
123
|
-
On DSH 0.2.2 and later
|
|
124
|
-
|
|
125
|
-
"…" menu
|
|
126
|
-
|
|
133
|
+
On DSH 0.2.2 and later the "…" button and right-click share one host menu, yet the
|
|
134
|
+
plugin's entries still appear only on right-click; flipping a switch also puts that
|
|
135
|
+
entry into the "…" menu. On 0.2.1 workspace rows have no host menu to contribute to,
|
|
136
|
+
so the plugin takes over the "…" button and draws the menu itself.
|
|
127
137
|
|
|
128
138
|
Switches live in browser `localStorage` (`dsh.sidebar-row-menu.items.v1`,
|
|
129
139
|
`dsh.sidebar-row-menu.open-with.v1`, `dsh.sidebar-row-menu.open-with.pinned.v1` and
|
|
@@ -416,6 +426,12 @@ re-dispatches is not a gesture.
|
|
|
416
426
|
Entries read the mark once while mounting, so a slow panel does not matter, and the
|
|
417
427
|
mark only lives until "the panel for this gesture appeared", never into the next one.
|
|
418
428
|
|
|
429
|
+
Workspace rows on 0.2.2 take a different path: the host menu is built from each
|
|
430
|
+
`ctx.contextMenus.register` provider's `resolve`, which has no React entry to read the
|
|
431
|
+
mark, so the provider checks the same mark while resolving. The "…" pointerdown
|
|
432
|
+
clears it before the host resolves, hence the entries show on right-click only; the
|
|
433
|
+
"Also show in the "…" menu → workspace" switches make the provider skip that check.
|
|
434
|
+
|
|
419
435
|
### Why the 0.2.1 menu is mounted imperatively
|
|
420
436
|
|
|
421
437
|
On 0.2.2 the host mounts every menu and the plugin creates no container. On 0.2.1 a
|
|
@@ -479,10 +495,13 @@ Built against DSH client `0.2.1-rc.5` and `0.2.2` (`ProjectRowItem`,
|
|
|
479
495
|
menus to a data-driven service, and the plugin picks the path by host capability:
|
|
480
496
|
|
|
481
497
|
- **0.2.2+**: workspace entries are registered with `ctx.contextMenus.register`
|
|
482
|
-
(New session 90,
|
|
483
|
-
Open
|
|
484
|
-
order with the native Rename (100), Reveal (200) and Delete workspace (300)
|
|
485
|
-
|
|
498
|
+
(New session 90, Open in new tab 110, Copy workspace path 150, pinned app 210,
|
|
499
|
+
Open with 220, Delete workspace and all sessions 310), interleaved by
|
|
500
|
+
order with the native Rename (100), Reveal (200) and Delete workspace (300) and
|
|
501
|
+
grouped with the same separators as the session menu.
|
|
502
|
+
Right-click and the "…" button share the host's single menu; providers answer only
|
|
503
|
+
during a right-click gesture (or when the matching "Also show in the "…" menu"
|
|
504
|
+
switch is on).
|
|
486
505
|
- **0.2.1**: no `contextMenus` service, so the plugin keeps drawing its own
|
|
487
506
|
workspace menu.
|
|
488
507
|
- **Session rows**: 0.2.2 still supports the
|
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
给 [DeepSeek Harness](https://github.com/deepseek-ai)(DSH)左侧边栏加右键菜单:
|
|
11
11
|
|
|
12
|
-
- **工作区行**:右键弹出菜单(DSH 0.2.2
|
|
12
|
+
- **工作区行**:右键弹出菜单(DSH 0.2.2 起并入宿主原生菜单,条目按 order 与内置项交错);
|
|
13
13
|
- **工作区下层的会话行**:右键在指针处展开该行自己的菜单,并追加本插件的条目。
|
|
14
14
|
|
|
15
15
|
DSH 0.2.2 把侧栏右键改成数据驱动:工作区菜单由宿主统一渲染,本插件按 order 把条目混排
|
|
@@ -22,7 +22,8 @@ DSH 0.2.2 把侧栏右键改成数据驱动:工作区菜单由宿主统一渲
|
|
|
22
22
|
`sidebar.workspaces.session.menu.item` slot —— 内置动作和其他插件的动作都在里面,
|
|
23
23
|
本插件只追加自己的条目,不复制、不硬编码任何内置动作。
|
|
24
24
|
|
|
25
|
-
>
|
|
25
|
+
> 点行尾「…」按钮看到的菜单保持 DSH 原样;本插件的条目默认只在右键展开时出现(0.2.2 上
|
|
26
|
+
> 工作区行与会话行都是如此,可以在设置里逐项开启)。
|
|
26
27
|
> 0.2.2 上右键与「…」共用同一份宿主菜单,插件按“右键手势”区分:右键时打标,等菜单面板
|
|
27
28
|
> 真正挂载后才收尾;点「…」的按下事件会立刻清标,所以那个菜单不带右键条目。
|
|
28
29
|
> 右键展开的菜单不会因为鼠标移出而关闭,只有点击外部、选中条目或按 Esc 才关闭。
|
|
@@ -32,19 +33,21 @@ DSH 0.2.2 把侧栏右键改成数据驱动:工作区菜单由宿主统一渲
|
|
|
32
33
|
### 工作区行右键
|
|
33
34
|
|
|
34
35
|
0.2.2 上这份菜单由宿主渲染,本插件条目与内置「重命名」(100)、「在文件夹显示」(200)、
|
|
35
|
-
「删除工作区」(300)按 order
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
「删除工作区」(300)按 order 交错,分组规则与会话菜单一致:新会话 90、在新标签打开 110、
|
|
37
|
+
复制工作区路径 150、置顶应用 210、打开方式 220、删除工作区及所有会话 310。这些条目默认
|
|
38
|
+
只出现在右键菜单;行尾「…」里的菜单保持原生,想让它也带上插件条目,可在设置里逐项开启
|
|
39
|
+
「同时放进「…」菜单 → 工作区」。0.2.1 上整份菜单由本插件自绘,「重命名」「删除工作区」
|
|
40
|
+
由插件调用官方对话框。
|
|
38
41
|
|
|
39
42
|
| 菜单项 | 行为 |
|
|
40
43
|
| --- | --- |
|
|
41
44
|
| 新会话 | 展开该工作区并新建会话(等价于行尾 `+`) |
|
|
42
45
|
| 重命名(内置) | 打开官方“重命名工作区”对话框;0.2.1 上由本插件代为渲染 |
|
|
43
|
-
| 置顶的打开方式 | 被置顶的应用直接显示在一级菜单(例如「用 Visual Studio Code 打开」),点击后用该应用打开工作区目录 |
|
|
44
|
-
| 打开方式 | 二级菜单列出宿主提供的外部应用(编辑器、终端、文件管理器);与会话菜单共用同一套应用列表、置顶与开关设置,鼠标悬浮自动展开 |
|
|
45
|
-
| 在文件夹显示(内置) | 在资源管理器里打开工作区目录;0.2.2 由宿主提供,0.2.1 上不出现 |
|
|
46
|
-
| 复制工作区路径 | 复制目录路径到剪贴板 |
|
|
47
46
|
| 在新标签中打开 | 仅在装有 `dsh-project-tabs`(暴露 `openWorkspaceInTab`)时出现 |
|
|
47
|
+
| 复制工作区路径 | 复制目录路径到剪贴板 |
|
|
48
|
+
| 在文件夹显示(内置) | 在资源管理器里打开工作区目录;0.2.2 由宿主提供,0.2.1 上不出现 |
|
|
49
|
+
| 置顶的打开方式 | 被置顶的应用直接显示在一级菜单(例如「用 Visual Studio Code 打开」),点击后用该应用打开工作区目录 |
|
|
50
|
+
| 打开方式 | 二级菜单列出宿主提供的外部应用(编辑器、终端、文件管理器);与会话菜单共用同一套应用列表、置顶与开关设置,鼠标悬浮自动展开。宿主的菜单项不画二级箭头,本插件把标签渲染成「文字 + 右对齐箭头」,与会话菜单同一位置;0.2.1 自绘菜单画的是箭头图标 |
|
|
48
51
|
| 删除工作区(内置) | 打开官方删除确认对话框;只删除工作区登记,会话保留并归入「未分组」。0.2.1 上由本插件代为渲染 |
|
|
49
52
|
| 删除工作区及所有会话 | 先永久删除该工作区下的每个会话及其日志,全部成功后再删除工作区登记;任一会话删除失败则保留工作区,便于重试。工作区目录本身不删除 |
|
|
50
53
|
|
|
@@ -78,9 +81,12 @@ DSH 0.2.2 把侧栏右键改成数据驱动:工作区菜单由宿主统一渲
|
|
|
78
81
|
「…」的按下事件会立刻清标。标记有效期内的条目正常渲染,其余情况渲染直接返回 `null`。
|
|
79
82
|
|
|
80
83
|
如果想直接使用行尾「…」菜单,可以在设置 →「行菜单」→「同时放进「…」菜单」里逐个开启:
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
+
|
|
85
|
+
- 会话条目:开启后挂进原生「…」菜单;
|
|
86
|
+
- 工作区条目(0.2.2):宿主菜单本身是数据驱动的,开启后 provider 解析时不再看手势,
|
|
87
|
+
条目直接进入「…」菜单;全部关闭时「…」里只有原生项;
|
|
88
|
+
- 工作区条目(0.2.1):开启任意一项后,本插件接管行尾「…」按钮,用同一套菜单展示
|
|
89
|
+
官方「重命名 / 删除工作区」加上已开启的插件条目。
|
|
84
90
|
|
|
85
91
|
草稿会话(还没有任何消息的空白会话)没有右键菜单,本插件同样不接管。
|
|
86
92
|
非工作区 / 非会话的侧边栏行(如“显示更多”)也不会被拦截。
|
|
@@ -96,13 +102,14 @@ DSH 0.2.2 把侧栏右键改成数据驱动:工作区菜单由宿主统一渲
|
|
|
96
102
|
| 永久删除会话 | 关闭后会话菜单里不再出现单条删除入口 |
|
|
97
103
|
| 允许删除未归档会话 | 默认关闭;开启后未归档会话的右键菜单也会出现「永久删除会话」,需先开启上一项 |
|
|
98
104
|
| 删除所有已归档会话 | 关闭后不再出现批量删除入口 |
|
|
99
|
-
| 同时放进「…」菜单 →
|
|
105
|
+
| 同时放进「…」菜单 → 工作区 | 逐项把工作区行右键条目也放进行尾「…」菜单:新会话、打开方式、复制工作区路径、在新标签中打开、删除工作区及所有会话。0.2.1 上开启任意一项后「…」按钮改由本插件渲染 |
|
|
100
106
|
| 同时放进「…」菜单 → 会话 | 逐项把会话行右键条目加进原生「…」菜单:打开方式、永久删除会话、删除所有已归档会话 |
|
|
101
107
|
|
|
102
108
|
「同时放进「…」菜单」下的开关默认全部关闭,`…` 菜单在未开启时与 DSH 完全一致。
|
|
103
109
|
|
|
104
|
-
DSH 0.2.2
|
|
105
|
-
|
|
110
|
+
DSH 0.2.2 起行尾「…」与右键共用同一份宿主菜单,但插件条目仍按手势只出现在右键菜单里;
|
|
111
|
+
上表的开关打开后,对应条目才会同时进入「…」菜单。0.2.1 上工作区行没有宿主菜单可贡献,
|
|
112
|
+
改由插件接管「…」按钮自绘。
|
|
106
113
|
|
|
107
114
|
开关存在浏览器 `localStorage`(`dsh.sidebar-row-menu.items.v1`、
|
|
108
115
|
`dsh.sidebar-row-menu.open-with.v1`、`dsh.sidebar-row-menu.open-with.pinned.v1` 与
|
|
@@ -360,6 +367,11 @@ test/*.test.mjs node:test
|
|
|
360
367
|
条目在挂载时读一次标记,所以面板挂得晚也不影响;标记只活到“这次手势对应的面板出现”,
|
|
361
368
|
不会漏进下一次。
|
|
362
369
|
|
|
370
|
+
工作区行在 0.2.2 上走的是另一条路:宿主菜单的数据来自 `ctx.contextMenus.register` 的
|
|
371
|
+
`resolve`,没有 React 条目可以读标记,所以 provider 在解析时直接判断同一枚手势标记,
|
|
372
|
+
并且行尾「…」的 `pointerdown` 清标发生在宿主解析之前 —— 右键时条目进菜单,点「…」时
|
|
373
|
+
不进。「同时放进「…」菜单 → 工作区」的开关则让 provider 跳过手势判断,条目不依赖右键。
|
|
374
|
+
|
|
363
375
|
### 为什么 0.2.1 的菜单是命令式挂载
|
|
364
376
|
|
|
365
377
|
0.2.2 的菜单全部由宿主挂载,插件不创建任何容器。0.2.1 上右键事件不是 React 渲染流的一部分,
|
|
@@ -411,10 +423,11 @@ DSH 宿主按该范围拒绝安装不兼容的宿主,插件市场也按它显
|
|
|
411
423
|
与 `contextMenus` 实现适配。DSH 0.2.2 起把侧栏右键菜单改成数据驱动,本包按宿主能力自动选路:
|
|
412
424
|
|
|
413
425
|
- **0.2.2 及以上**:工作区行改用 `ctx.contextMenus.register` 贡献动作
|
|
414
|
-
(新会话 90、置顶应用
|
|
415
|
-
与原生「重命名」「在文件夹显示」「删除工作区」按 order
|
|
416
|
-
|
|
417
|
-
|
|
426
|
+
(新会话 90、新标签 110、复制路径 150、置顶应用 210、打开方式 220、删除工作区及所有会话 310),
|
|
427
|
+
与原生「重命名」「在文件夹显示」「删除工作区」按 order 交错排列;分组分隔线与会话菜单同一
|
|
428
|
+
套规则。右键与「…」共用同一份宿主菜单,插件不再自绘,也不再接管「…」按钮。provider 解析时
|
|
429
|
+
按右键手势(或设置里「同时放进「…」菜单」的开关)决定是否返回条目。会话行由宿主自己把原生
|
|
430
|
+
菜单开在指针处,本包条目继续从 `sidebar.workspaces.session.menu.item` 渲染;
|
|
418
431
|
- **0.2.1**:没有 `contextMenus` 服务,保持原来的自绘工作区菜单;会话右键仍由插件把
|
|
419
432
|
行尾「…」菜单搬到指针。
|
|
420
433
|
|
package/lib/client.js
CHANGED
|
@@ -186,8 +186,7 @@ window.__ModuleLoader__.load({
|
|
|
186
186
|
'settings.expand': '展开应用列表',
|
|
187
187
|
'settings.collapse': '收起应用列表',
|
|
188
188
|
'settings.ellipsisTitle': '同时放进「…」菜单',
|
|
189
|
-
'settings.ellipsisHint': '
|
|
190
|
-
'settings.ellipsisHintNative': '当前 DSH 版本的「…」按钮与右键共用同一份菜单,工作区行无需单独登记;这里只保留会话行的开关。',
|
|
189
|
+
'settings.ellipsisHint': 'DSH 0.2.2 起「…」按钮与右键共用同一份菜单:勾选后对应条目也会出现在「…」菜单里,并沿用上面的单项开关;不勾选则只在右键菜单出现。',
|
|
191
190
|
'settings.ellipsisWorkspace': '工作区行',
|
|
192
191
|
'settings.ellipsisSession': '会话行',
|
|
193
192
|
'settings.ellipsis.newSession.label': '新建会话',
|
|
@@ -271,8 +270,7 @@ window.__ModuleLoader__.load({
|
|
|
271
270
|
'settings.expand': 'Show applications',
|
|
272
271
|
'settings.collapse': 'Hide applications',
|
|
273
272
|
'settings.ellipsisTitle': 'Also show in the "…" menu',
|
|
274
|
-
'settings.ellipsisHint': '
|
|
275
|
-
'settings.ellipsisHintNative': 'In this DSH version the "…" button opens the same menu as right-click, so workspace rows need no separate entries; only the session row switches below apply.',
|
|
273
|
+
'settings.ellipsisHint': 'Since DSH 0.2.2 the "…" button opens the same menu as right-click: checked entries also appear there, still subject to the switches above. Unchecked entries stay right-click only.',
|
|
276
274
|
'settings.ellipsisWorkspace': 'Workspace rows',
|
|
277
275
|
'settings.ellipsisSession': 'Session rows',
|
|
278
276
|
'settings.ellipsis.newSession.label': 'New session',
|
|
@@ -1503,11 +1501,6 @@ window.__ModuleLoader__.load({
|
|
|
1503
1501
|
const children = useChildren();
|
|
1504
1502
|
const apps = useApps();
|
|
1505
1503
|
usePinned();
|
|
1506
|
-
// 0.2.2 起行尾「…」与右键共用同一份原生菜单,工作区行的附加开关不再生效。
|
|
1507
|
-
const nativeEllipsis = contextMenusOf(rootCtx) !== null;
|
|
1508
|
-
const ellipsisRows = nativeEllipsis
|
|
1509
|
-
? ELLIPSIS_ROWS.filter(([groupKey]) => groupKey !== 'workspace')
|
|
1510
|
-
: ELLIPSIS_ROWS;
|
|
1511
1504
|
const [expanded, setExpanded] = useState(false);
|
|
1512
1505
|
const anyConflict = takenOver('openWith') || takenOver('deleteSession') || takenOver('deleteArchived');
|
|
1513
1506
|
const locked = items.openWith === false;
|
|
@@ -1587,7 +1580,7 @@ window.__ModuleLoader__.load({
|
|
|
1587
1580
|
return key === 'openWith' && childRows ? [row, childRows] : [row];
|
|
1588
1581
|
});
|
|
1589
1582
|
|
|
1590
|
-
const ellipsisGroups =
|
|
1583
|
+
const ellipsisGroups = ELLIPSIS_ROWS.map(([groupKey, titleKey, rows]) => h('div', {
|
|
1591
1584
|
className: 'dsrm-settings-group',
|
|
1592
1585
|
key: groupKey,
|
|
1593
1586
|
},
|
|
@@ -1615,7 +1608,7 @@ window.__ModuleLoader__.load({
|
|
|
1615
1608
|
anyConflict ? h('div', { className: 'dsrm-settings-note' }, t('settings.conflictNote')) : null,
|
|
1616
1609
|
h('div', { className: 'dsrm-settings-list' }, rows),
|
|
1617
1610
|
h('h2', { className: 'dsrm-settings-title dsrm-settings-subtitle' }, t('settings.ellipsisTitle')),
|
|
1618
|
-
h('div', { className: 'dsrm-settings-note' }, t(
|
|
1611
|
+
h('div', { className: 'dsrm-settings-note' }, t('settings.ellipsisHint')),
|
|
1619
1612
|
h('div', { className: 'dsrm-settings-groups' }, ellipsisGroups),
|
|
1620
1613
|
);
|
|
1621
1614
|
}
|
|
@@ -1895,6 +1888,9 @@ window.__ModuleLoader__.load({
|
|
|
1895
1888
|
if (event.defaultPrevented || event.button !== 0) return;
|
|
1896
1889
|
if (event.target === null || event.target === undefined) return;
|
|
1897
1890
|
if (rootCtx === null || !workspaceEllipsisOn()) return;
|
|
1891
|
+
// 0.2.2 起宿主菜单本身就是数据驱动的:附加条目由 provider 按开关加进去,
|
|
1892
|
+
// 再接管「…」只会把原生菜单换成自绘的那一份。
|
|
1893
|
+
if (contextMenusOf(rootCtx) !== null) return;
|
|
1898
1894
|
const target = event.target;
|
|
1899
1895
|
if (typeof target.closest !== 'function') return;
|
|
1900
1896
|
const row = target.closest('[data-row-key]');
|
|
@@ -2119,39 +2115,32 @@ window.__ModuleLoader__.load({
|
|
|
2119
2115
|
const apps = appsSnapshot();
|
|
2120
2116
|
const withApps = itemsSnapshot().openWith !== false;
|
|
2121
2117
|
const pinned = withApps ? effectivePinned(apps.ids).filter((id) => childOn(id)) : [];
|
|
2122
|
-
pinned.forEach((id, index) => {
|
|
2123
|
-
items.push({
|
|
2124
|
-
id: `pinned-${id}`,
|
|
2125
|
-
group: 'pinned',
|
|
2126
|
-
separatorBefore: index === 0,
|
|
2127
|
-
label: t('openWithApp', { name: appLabel(id, t) }),
|
|
2128
|
-
icon: { key: 'sidebar-row-menu.app', src: ICON_ROUTE + encodeURIComponent(id) },
|
|
2129
|
-
run: () => openAppAt(id, cwd, t),
|
|
2130
|
-
});
|
|
2131
|
-
});
|
|
2132
2118
|
const enabledApps = withApps ? apps.ids.filter((id) => childOn(id)) : [];
|
|
2133
2119
|
const pinnedSet = new Set(pinned);
|
|
2134
2120
|
const submenuApps = enabledApps.filter((id) => !pinnedSet.has(id));
|
|
2135
2121
|
if (withApps) ensureApps();
|
|
2136
|
-
|
|
2122
|
+
|
|
2123
|
+
// 与会话菜单同一套分组:行内动作 → 复制/在文件夹显示 → 打开方式 → 删除。
|
|
2124
|
+
const tabs = serviceOf(rootCtx, 'projectTabs') ?? globalThis.__DSH_PROJECT_TABS__ ?? null;
|
|
2125
|
+
if (tabs !== null && typeof tabs?.openWorkspaceInTab === 'function') {
|
|
2137
2126
|
items.push({
|
|
2138
|
-
id: '
|
|
2139
|
-
group: '
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
}
|
|
2127
|
+
id: 'tab',
|
|
2128
|
+
group: 'tab',
|
|
2129
|
+
label: t('openInTab'),
|
|
2130
|
+
icon: { key: 'sidebar-row-menu.tab' },
|
|
2131
|
+
run: () => {
|
|
2132
|
+
Promise.resolve().then(() => tabs.openWorkspaceInTab(workspaceId)).catch((reason) => {
|
|
2133
|
+
console.warn('[dsh-sidebar-row-menu] open in tab failed:', reason);
|
|
2134
|
+
toast(t('actionFailed'));
|
|
2135
|
+
});
|
|
2136
|
+
},
|
|
2148
2137
|
});
|
|
2149
2138
|
}
|
|
2150
2139
|
|
|
2151
2140
|
items.push({
|
|
2152
2141
|
id: 'copy-path',
|
|
2153
2142
|
group: 'copy',
|
|
2154
|
-
separatorBefore:
|
|
2143
|
+
separatorBefore: true,
|
|
2155
2144
|
label: t('copyPath'),
|
|
2156
2145
|
icon: { key: 'sidebar-row-menu.copy' },
|
|
2157
2146
|
run: () => {
|
|
@@ -2163,19 +2152,36 @@ window.__ModuleLoader__.load({
|
|
|
2163
2152
|
},
|
|
2164
2153
|
});
|
|
2165
2154
|
|
|
2166
|
-
|
|
2167
|
-
if (tabs !== null && typeof tabs?.openWorkspaceInTab === 'function') {
|
|
2155
|
+
pinned.forEach((id, index) => {
|
|
2168
2156
|
items.push({
|
|
2169
|
-
id:
|
|
2170
|
-
group: '
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2157
|
+
id: `pinned-${id}`,
|
|
2158
|
+
group: 'pinned',
|
|
2159
|
+
separatorBefore: index === 0,
|
|
2160
|
+
label: t('openWithApp', { name: appLabel(id, t) }),
|
|
2161
|
+
icon: { key: 'sidebar-row-menu.app', src: ICON_ROUTE + encodeURIComponent(id) },
|
|
2162
|
+
run: () => openAppAt(id, cwd, t),
|
|
2163
|
+
});
|
|
2164
|
+
});
|
|
2165
|
+
|
|
2166
|
+
if (withApps && submenuApps.length > 0) {
|
|
2167
|
+
items.push({
|
|
2168
|
+
id: 'open-with',
|
|
2169
|
+
group: 'open-with',
|
|
2170
|
+
separatorBefore: pinned.length === 0,
|
|
2171
|
+
// 宿主的菜单项对子菜单只设 aria-haspopup,不画右侧箭头。label 在宿主里
|
|
2172
|
+
// 是直接当 children 渲染的,所以这里塞一个右对齐的箭头元素,与会话菜单
|
|
2173
|
+
// 里的「打开方式」保持同一套外观(0.2.1 自绘菜单本来就是自己画的)。
|
|
2174
|
+
label: h('span', { className: 'dsrm-host-label' },
|
|
2175
|
+
h('span', { className: 'dsrm-host-label-text' }, t('openWith')),
|
|
2176
|
+
jsx(IconChevronRightOutlineRegular, { size: 12, className: 'dsrm-submenu-chevron' }),
|
|
2177
|
+
),
|
|
2178
|
+
icon: { key: 'sidebar-row-menu.open-with' },
|
|
2179
|
+
children: submenuApps.map((id) => ({
|
|
2180
|
+
id: `app-${id}`,
|
|
2181
|
+
label: appLabel(id, t),
|
|
2182
|
+
icon: { key: 'sidebar-row-menu.app', src: ICON_ROUTE + encodeURIComponent(id) },
|
|
2183
|
+
run: () => openAppAt(id, cwd, t),
|
|
2184
|
+
})),
|
|
2179
2185
|
});
|
|
2180
2186
|
}
|
|
2181
2187
|
|
|
@@ -2203,13 +2209,32 @@ window.__ModuleLoader__.load({
|
|
|
2203
2209
|
/** 宿主只按 provider.order 排序,同组顺序即数组顺序;故每组单独注册。 */
|
|
2204
2210
|
const WORKSPACE_MENU_GROUPS = [
|
|
2205
2211
|
{ key: 'new', order: 90 },
|
|
2206
|
-
{ key: '
|
|
2207
|
-
{ key: '
|
|
2208
|
-
{ key: '
|
|
2209
|
-
{ key: '
|
|
2212
|
+
{ key: 'tab', order: 110 },
|
|
2213
|
+
{ key: 'copy', order: 150 },
|
|
2214
|
+
{ key: 'pinned', order: 210 },
|
|
2215
|
+
{ key: 'open-with', order: 220 },
|
|
2210
2216
|
{ key: 'delete', order: 310 },
|
|
2211
2217
|
];
|
|
2212
2218
|
|
|
2219
|
+
/**
|
|
2220
|
+
* 0.2.2 的「…」按钮与右键共用同一份宿主菜单,条目本身无法感知手势,
|
|
2221
|
+
* 所以按右键标记决定是否进入这份菜单;打开对应附加开关后,点「…」也显示。
|
|
2222
|
+
*/
|
|
2223
|
+
const WORKSPACE_GROUP_ELLIPSIS = {
|
|
2224
|
+
new: 'newSession',
|
|
2225
|
+
pinned: 'openWith',
|
|
2226
|
+
'open-with': 'openWith',
|
|
2227
|
+
copy: 'copyPath',
|
|
2228
|
+
tab: 'openInTab',
|
|
2229
|
+
delete: 'deleteSessions',
|
|
2230
|
+
};
|
|
2231
|
+
|
|
2232
|
+
function workspaceGroupVisible(groupKey) {
|
|
2233
|
+
if (rightClickMark) return true;
|
|
2234
|
+
const key = WORKSPACE_GROUP_ELLIPSIS[groupKey];
|
|
2235
|
+
return key !== undefined && ellipsisSettings[key] === true;
|
|
2236
|
+
}
|
|
2237
|
+
|
|
2213
2238
|
/** 注册工作区动作;服务可能晚于插件 apply 出现,带有限重试。 */
|
|
2214
2239
|
function registerWorkspaceContextMenu(ctx) {
|
|
2215
2240
|
let disposers = null;
|
|
@@ -2223,6 +2248,7 @@ window.__ModuleLoader__.load({
|
|
|
2223
2248
|
yield ctx.slots.register({ name: 'contextMenu.icon', key: 'sidebar-row-menu.new' }, IconNewChatOutlineRegular);
|
|
2224
2249
|
yield ctx.slots.register({ name: 'contextMenu.icon', key: 'sidebar-row-menu.copy' }, IconCopyOutlineRegular);
|
|
2225
2250
|
yield ctx.slots.register({ name: 'contextMenu.icon', key: 'sidebar-row-menu.tab' }, IconProjectAddOutlineRegular);
|
|
2251
|
+
yield ctx.slots.register({ name: 'contextMenu.icon', key: 'sidebar-row-menu.open-with' }, IconRightUpOutlineRegular);
|
|
2226
2252
|
yield ctx.slots.register({ name: 'contextMenu.icon', key: 'sidebar-row-menu.delete' }, IconTrashOutlineRegular);
|
|
2227
2253
|
yield ctx.slots.register({ name: 'contextMenu.icon', key: 'sidebar-row-menu.app' }, ContextMenuAppIcon);
|
|
2228
2254
|
});
|
|
@@ -2247,9 +2273,12 @@ window.__ModuleLoader__.load({
|
|
|
2247
2273
|
target: 'workspace',
|
|
2248
2274
|
order: group.order,
|
|
2249
2275
|
observe: () => [appsSource],
|
|
2250
|
-
resolve: (target) =>
|
|
2251
|
-
|
|
2252
|
-
|
|
2276
|
+
resolve: (target) => {
|
|
2277
|
+
if (!workspaceGroupVisible(group.key)) return [];
|
|
2278
|
+
return workspaceMenuActions(ctx, target, localeOf(ctx))
|
|
2279
|
+
.filter((action) => action.group === group.key)
|
|
2280
|
+
.map(({ group: _group, ...action }) => action);
|
|
2281
|
+
},
|
|
2253
2282
|
}));
|
|
2254
2283
|
} catch (error) {
|
|
2255
2284
|
console.warn(`[dsh-sidebar-row-menu] workspace context registration failed (${group.key}):`, error);
|
|
@@ -2482,11 +2511,15 @@ window.__ModuleLoader__.load({
|
|
|
2482
2511
|
.dsrm-submenu-trigger:hover:not(:disabled),.dsrm-submenu-trigger:focus-visible{background:var(--dsw-alias-interactive-bg-hover);outline:none}
|
|
2483
2512
|
.dsrm-submenu-label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
2484
2513
|
.dsrm-submenu-chevron{color:var(--dsw-alias-label-caption)}
|
|
2514
|
+
.dsrm-host-label{display:flex;align-items:center;gap:6px;width:100%}
|
|
2515
|
+
.dsrm-host-label-text{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis}
|
|
2485
2516
|
.dsrm-submenu{position:fixed;z-index:1101;min-width:180px;max-width:300px;max-height:min(380px,64vh);overflow:auto;padding:4px}
|
|
2486
2517
|
.dsrm-submenu-empty{padding:6px 8px;color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:18px}
|
|
2487
2518
|
.dsrm-menu{position:fixed;z-index:2147483647}
|
|
2488
2519
|
.dsrm-menu-surface{min-width:210px;padding:4px}
|
|
2489
2520
|
.dsrm-sep{height:.5px;margin:3px 2px;background:var(--dsw-alias-border-l2)}
|
|
2521
|
+
/* 150% 缩放等分数像素比下,宿主 0.5px 的分隔线会被摊成两行近乎透明,补到 1px 才看得见。 */
|
|
2522
|
+
@media (min-resolution:1.2dppx) and (max-resolution:1.99dppx){[role="menu"] [role="separator"],.dsrm-sep{height:1px}}
|
|
2490
2523
|
.dsrm-app-icon{width:14px;height:14px;border-radius:3px;display:block;object-fit:contain}
|
|
2491
2524
|
.dsrm-settings{max-width:820px;margin:0 auto;padding:2px 0 36px}
|
|
2492
2525
|
.dsrm-settings-title{margin:0;font-size:16px;line-height:24px;font-weight:600}
|
|
@@ -2554,6 +2587,18 @@ window.__ModuleLoader__.load({
|
|
|
2554
2587
|
const rowKey = row.getAttribute('data-row-key') ?? '';
|
|
2555
2588
|
if (!rowKey.startsWith('workspace:') && !rowKey.startsWith('session:')) return;
|
|
2556
2589
|
|
|
2590
|
+
// 宿主自己会处理右键(0.2.2):只打手势标记,菜单交给宿主开在指针处。
|
|
2591
|
+
// 这样既不用改锚点、也不用代点「…」,少两层时序假设;provider 在解析时用
|
|
2592
|
+
// 这个标记决定条目是否进入菜单(「…」的按下会先清标)。
|
|
2593
|
+
if (hasNativeRowMenu(row)) {
|
|
2594
|
+
if (rowKey.startsWith('session:') && resolveSessionRow(start) === null) return;
|
|
2595
|
+
markRightClickMenu();
|
|
2596
|
+
primeRowActionPointer(typeof row.querySelector === 'function'
|
|
2597
|
+
? row.querySelector('[class*="rowActions"] button')
|
|
2598
|
+
: null);
|
|
2599
|
+
return;
|
|
2600
|
+
}
|
|
2601
|
+
|
|
2557
2602
|
if (rowKey.startsWith('workspace:')) {
|
|
2558
2603
|
const props = resolveWorkspaceRow(start);
|
|
2559
2604
|
if (props === null) {
|
|
@@ -2570,15 +2615,6 @@ window.__ModuleLoader__.load({
|
|
|
2570
2615
|
}
|
|
2571
2616
|
|
|
2572
2617
|
if (resolveSessionRow(start) === null) return;
|
|
2573
|
-
// 宿主自己会处理右键(0.2.2):只打手势标记,菜单交给宿主开在指针处。
|
|
2574
|
-
// 这样既不用改锚点、也不用代点「…」,少两层时序假设。
|
|
2575
|
-
if (hasNativeRowMenu(row)) {
|
|
2576
|
-
markRightClickMenu();
|
|
2577
|
-
primeRowActionPointer(typeof row.querySelector === 'function'
|
|
2578
|
-
? row.querySelector('[class*="rowActions"] button')
|
|
2579
|
-
: null);
|
|
2580
|
-
return;
|
|
2581
|
-
}
|
|
2582
2618
|
event.preventDefault();
|
|
2583
2619
|
event.stopPropagation();
|
|
2584
2620
|
event.stopImmediatePropagation?.();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-sidebar-row-menu",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Adds open-with and cleanup entries to the DSH sidebar context menus: interleaved with the built-in workspace menu and extending the session menu at the pointer on DSH 0.2.2+, with a self-drawn workspace menu on 0.2.1.",
|
|
6
6
|
"keywords": [
|