dsh-vscode-mode 0.27.1 → 0.27.2

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/README.md CHANGED
@@ -587,13 +587,13 @@ profile 请替换为实际目标,不要把示例目录当成当前运行 profi
587
587
 
588
588
  ```bash
589
589
  # ① Git 安装(clone + prepare 构建;推荐打固定 tag)
590
- dsh plugin --profile web add github:Lenonss/DSH_VsCodeMode#v0.27.1
590
+ dsh plugin --profile web add github:Lenonss/DSH_VsCodeMode#v0.27.2
591
591
 
592
592
  # ② npm 注册表(发布到 npm 后)
593
- dsh plugin --profile web add dsh-vscode-mode@0.27.1
593
+ dsh plugin --profile web add dsh-vscode-mode@0.27.2
594
594
 
595
595
  # ③ GitHub Release tgz 直装(Release asset 可用后)
596
- dsh plugin --profile web add https://github.com/Lenonss/DSH_VsCodeMode/releases/download/v0.27.1/dsh-vscode-mode-0.27.1.tgz
596
+ dsh plugin --profile web add https://github.com/Lenonss/DSH_VsCodeMode/releases/download/v0.27.2/dsh-vscode-mode-0.27.2.tgz
597
597
  ```
598
598
 
599
599
  > **DSH 版本政策(0.17.0 起)**:六项 DSH peer 仍统一声明为 `*`,另以
@@ -973,6 +973,7 @@ Keep All / Undo All 却是亮的。修复:单文件 Keep / Undo 覆盖冲突
973
973
 
974
974
  | 版本 | 要点 |
975
975
  | --- | --- |
976
+ | v0.27.2 | 当前编辑文件 Tab 自动滚入可见区域;分组独立定位,适配宽度变化,不抢编辑焦点 |
976
977
  | v0.27.1 | 修复仅 LF/CRLF 或 BOM 差异造成的空待审与差异栏残留;统一累计待审路径路由并过滤已归档历史记录 |
977
978
  | v0.27.0 | DSH alpha.3 官方菜单/Forge 导航/设置图标与能力诊断;多目标 patch 字节采集;回滚版本与会话策略守卫;工作区共享差异基线;隐藏轮询门控与导航隔离 |
978
979
  | v0.26.0 | Keep All 改为单次批量(不再因单条过期/冷端条目整批中止,2N+1 次往返降到 2 次);差异审查旧通道遗留清理:待审接管的旧记录自动结案、守卫改会话作用域、失败原因不再被通用文案吞掉 |
@@ -987,7 +988,9 @@ Keep All / Undo All 却是亮的。修复:单文件 Keep / Undo 覆盖冲突
987
988
  | v0.23.0 | 快捷菜单:可拖动悬浮按钮 + 自定义菜单树 |
988
989
 
989
990
  <details>
990
- <summary>完整版本记录(v0.27.1 → v0.1.5x,点击展开)</summary>
991
+ <summary>完整版本记录(v0.27.2 → v0.1.5x,点击展开)</summary>
992
+
993
+ - **v0.27.2**:活动文件与计划预览 Tab 按编辑分组独立保持可见;打开、切换、关闭页签及编辑区尺寸变化后做最小横向定位,已可见时不滚动,不抢键盘焦点、不带动正文。保留手动横滚,超宽 Tab 显示名称起始部分。当前 GUI 未加载新 bundle,真实交互验收缺口已由用户接受;发布不自动安装或重启。参见 [0.27.2 发布说明](docs/release-0.27.2.md)。
991
994
 
992
995
  - **v0.27.1**:净零判定复用差异生成器的逻辑行口径,消除仅 LF/CRLF 或 BOM 不同造成的「无差异块但仍计入待审」;保留真实文本与末尾换行增删,不改原始快照和磁盘文件。累计待审详情与工具栏统一身份解析,避免误走历史改动栏;汇总与批量列表排除已归档记录。客户端空文本差异收敛保留现有能力、脏缓冲和忙状态守卫。Web Host 重启后实测三个空待审归零、差异栏消失,三个游戏文件 SHA256 不变。参见 [0.27.1 发布说明](docs/release-0.27.1.md)。
993
996
 
package/lib/client.js CHANGED
@@ -380,11 +380,105 @@ window.__ModuleLoader__.load({
380
380
  };
381
381
  }
382
382
  //#endregion
383
+ //#region src/client/ui/tabReveal.ts
384
+ /** Group-local active tab visibility. @author ddj 2026年11月05号 */
385
+ /**
386
+ * Reveal the selected tab without moving the page or keyboard focus.
387
+ * @public @author ddj 2026年11月05号
388
+ * @param host Tab strip belonging to one editor group.
389
+ * @sideEffects Updates only the strip's horizontal scroll position.
390
+ */
391
+ function revealTab(host) {
392
+ const tab = host.querySelector(".edrv-tab-active");
393
+ if (!tab || host.clientWidth <= 0) return;
394
+ const stripRect = host.getBoundingClientRect();
395
+ const tabRect = tab.getBoundingClientRect();
396
+ const left = stripRect.left + host.clientLeft;
397
+ const right = left + host.clientWidth;
398
+ let delta = 0;
399
+ if (tabRect.width > host.clientWidth || tabRect.left < left) delta = tabRect.left - left;
400
+ else if (tabRect.right > right) delta = tabRect.right - right;
401
+ if (Math.abs(delta) < .5) return;
402
+ const maximum = Math.max(0, host.scrollWidth - host.clientWidth);
403
+ const next = Math.max(0, Math.min(maximum, host.scrollLeft + delta));
404
+ if (next !== host.scrollLeft) host.scrollLeft = next;
405
+ }
406
+ /**
407
+ * Observe geometry changes, not scrolling, so manual tab browsing remains possible.
408
+ * @public @author ddj 2026年11月05号
409
+ * @param host Group tab strip after its DOM commit.
410
+ * @returns Cleanup cancelling pending work and disconnecting geometry observation.
411
+ */
412
+ function watchTabReveal(host) {
413
+ const view = host.ownerDocument.defaultView;
414
+ let frame;
415
+ let disposed = false;
416
+ /** @private @author ddj 2026年11月05号 Reveal the latest selected tab after layout. */
417
+ function measure() {
418
+ frame = void 0;
419
+ if (!disposed) revealTab(host);
420
+ }
421
+ /** @private @author ddj 2026年11月05号 Coalesce resize notifications into one layout read. */
422
+ function schedule() {
423
+ if (disposed || frame !== void 0 || !view) return;
424
+ frame = view.requestAnimationFrame(measure);
425
+ }
426
+ revealTab(host);
427
+ schedule();
428
+ const observer = typeof ResizeObserver === "function" ? new ResizeObserver(schedule) : void 0;
429
+ observer?.observe(host);
430
+ const tab = host.querySelector(".edrv-tab-active");
431
+ if (tab) observer?.observe(tab);
432
+ /** @private @author ddj 2026年11月05号 Cancel work owned by the previous selection or pane. */
433
+ function dispose() {
434
+ disposed = true;
435
+ observer?.disconnect();
436
+ if (frame !== void 0) view?.cancelAnimationFrame(frame);
437
+ frame = void 0;
438
+ }
439
+ return dispose;
440
+ }
441
+ //#endregion
383
442
  //#region src/client/ui/EditorPane.ts
384
443
  /** Independent group views; workbench owns documents, saves and commands. @author ddj 2026年10月14号 */
444
+ /**
445
+ * Keep each group's selected tab visible while preserving the workbench wheel ref.
446
+ * @private @author ddj 2026年11月05号
447
+ * @param props Group selection and shared strip reference.
448
+ * @returns Stable callback ref for this pane's strip.
449
+ */
450
+ function useTabReveal(props) {
451
+ const hostRef = react$1.default.useRef(null);
452
+ /** @private @author ddj 2026年11月05号 @param node Committed strip, or null on detach. Synchronize both owners. */
453
+ function bindStrip(node) {
454
+ hostRef.current = node;
455
+ if (typeof props.tabsRef === "function") props.tabsRef(node);
456
+ else if (props.tabsRef) props.tabsRef.current = node;
457
+ }
458
+ const stripRef = react$1.default.useCallback(bindStrip, [props.tabsRef]);
459
+ const tabShape = JSON.stringify(props.group.tabs.map((tab) => [
460
+ tab.path,
461
+ tab.pinned,
462
+ props.dirty[tab.path]
463
+ ]));
464
+ /** @private @author ddj 2026年11月05号 @returns Geometry observer cleanup for this committed selection. */
465
+ function observeStrip() {
466
+ if (hostRef.current) return watchTabReveal(hostRef.current);
467
+ }
468
+ react$1.default.useLayoutEffect(observeStrip, [
469
+ props.group.active,
470
+ props.focused,
471
+ props.suppressActive,
472
+ props.previewActive,
473
+ tabShape,
474
+ props.tabsRef
475
+ ]);
476
+ return stripRef;
477
+ }
385
478
  /** @public @author ddj 2026年10月14号 @param props Group callbacks and file view. @returns Accessible tab strip and drop target. */
386
479
  function EditorPane(props) {
387
480
  const { group } = props;
481
+ const stripRef = useTabReveal(props);
388
482
  const suppressActive = props.suppressActive === true;
389
483
  /** @private @author ddj 2026年10月20号 @param tab File record. @returns Draggable tab with isolated close control. */
390
484
  function renderTab(tab) {
@@ -465,7 +559,7 @@ window.__ModuleLoader__.load({
465
559
  className: "edrv-tabs",
466
560
  role: "tablist",
467
561
  "data-edrv-group-tabs": group.id,
468
- ref: props.tabsRef
562
+ ref: stripRef
469
563
  }, group.tabs.map(renderTab), props.extras), props.tools), react$1.default.createElement("div", {
470
564
  className: "edrv-group-body",
471
565
  role: "tabpanel"
@@ -396586,22 +396680,6 @@ td.UniverTableCell, th.UniverTableCell{mso-padding-alt:0cm 5.4pt 0cm 5.4pt;}
396586
396680
  for (const [eventName] of handlers) window.removeEventListener(eventName, onCommand);
396587
396681
  };
396588
396682
  }, [sessionId]);
396589
- react$1.default.useEffect(() => {
396590
- const host = tabsHostRef.current;
396591
- if (!host) return;
396592
- const el = host.querySelector?.(".edrv-tab-active");
396593
- if (!el) return;
396594
- const left = el.offsetLeft;
396595
- const right = left + el.offsetWidth;
396596
- if (left < host.scrollLeft) host.scrollLeft = left;
396597
- else if (right > host.scrollLeft + host.clientWidth) host.scrollLeft = right - host.clientWidth;
396598
- }, [
396599
- active,
396600
- planActive,
396601
- planTabs.length,
396602
- tabs.length,
396603
- rowOwner
396604
- ]);
396605
396683
  react$1.default.useEffect(() => attachHorizontalWheel(tabsHostRef.current), [rowOwner]);
396606
396684
  react$1.default.useEffect(() => {
396607
396685
  const onPointer = (e) => {
@@ -399528,6 +399606,7 @@ td.UniverTableCell, th.UniverTableCell{mso-padding-alt:0cm 5.4pt 0cm 5.4pt;}
399528
399606
  focused,
399529
399607
  dirty: dirtyMap,
399530
399608
  suppressActive: hideDiskActive,
399609
+ previewActive: chrome ? planActive : void 0,
399531
399610
  tabsRef: chrome ? tabsHostRef : void 0,
399532
399611
  extras: chrome ? planTabExtras : void 0,
399533
399612
  tools: chrome ? rowTools : void 0,
package/lib/client.js.map CHANGED
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: package/lib/client.js.map
3
- size: 35796301 bytes
4
- sha256: 2982d27d96e985ee9a5893d3b7ec831282dbff4552db9d6cafea17ad3186e806
3
+ size: 35801402 bytes
4
+ sha256: 91105e05ed90baaf23e1c0d55a8001446938926165eb9229feac384c3290c79b
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-vscode-mode",
3
- "version": "0.27.1",
3
+ "version": "0.27.2",
4
4
  "description": "DSH 上的类 VSCode 编码体验:Monaco 编辑器(文件页签/QuickOpen/状态栏,可驻 DSH 0.1.5+ 官方右侧 Sidebar 与对话同屏)+ 命令栏(Ctrl+Shift+P)与可扩展指令系统 + VS Code 兼容代码片段(.code-snippets 全局/项目,IntelliSense 展开)+ Agent 编辑差异审查(整文件差异/采纳/拒绝/归档/回滚)+ SVN 集成(侧栏变更面板/日志弹窗/并排差异)+ 语言服务器(LSP)智能(跳转定义/引用/hover/大纲 + VSIX 扩展市场安装),状态持久化到工作区旁车,界面状态(页签/光标/侧栏/编辑 Tab/导航历史)镜像到 DSH home 跨重启恢复",
5
5
  "icon": "assets/icon.svg",
6
6
  "keywords": [
@@ -3,6 +3,7 @@ import React from 'react'
3
3
  import { createViewKeeper, type ViewEditor } from '../state/editorViewState.js'
4
4
  import type { Group } from '../state/editorLayout.js'
5
5
  import type { TabLike } from '../tabActions.js'
6
+ import { watchTabReveal } from './tabReveal.js'
6
7
 
7
8
  export interface PaneProps {
8
9
  group: Group
@@ -22,11 +23,39 @@ export interface PaneProps {
22
23
  tabsRef?: React.Ref<HTMLDivElement>
23
24
  /** @public @author ddj 2026年10月20号 Read-only plan preview owns this pane body, so no disk tab paints as active. */
24
25
  suppressActive?: boolean
26
+ /** @public @author ddj 2026年11月05号 Selected virtual preview address, when this strip owns preview tabs. */
27
+ previewActive?: string | null
28
+ }
29
+
30
+ /**
31
+ * Keep each group's selected tab visible while preserving the workbench wheel ref.
32
+ * @private @author ddj 2026年11月05号
33
+ * @param props Group selection and shared strip reference.
34
+ * @returns Stable callback ref for this pane's strip.
35
+ */
36
+ function useTabReveal(props: PaneProps): React.RefCallback<HTMLDivElement> {
37
+ const hostRef = React.useRef<HTMLDivElement | null>(null)
38
+ /** @private @author ddj 2026年11月05号 @param node Committed strip, or null on detach. Synchronize both owners. */
39
+ function bindStrip(node: HTMLDivElement | null): void {
40
+ hostRef.current = node
41
+ if (typeof props.tabsRef === 'function') props.tabsRef(node)
42
+ else if (props.tabsRef) (props.tabsRef as React.MutableRefObject<HTMLDivElement | null>).current = node
43
+ }
44
+ const stripRef = React.useCallback(bindStrip, [props.tabsRef])
45
+ // Include the rendered order/labels: closing, pinning or dirty marks can shift a same-path selection.
46
+ const tabShape = JSON.stringify(props.group.tabs.map(tab => [tab.path, tab.pinned, props.dirty[tab.path]]))
47
+ /** @private @author ddj 2026年11月05号 @returns Geometry observer cleanup for this committed selection. */
48
+ function observeStrip(): (() => void) | undefined {
49
+ if (hostRef.current) return watchTabReveal(hostRef.current)
50
+ }
51
+ React.useLayoutEffect(observeStrip, [props.group.active, props.focused, props.suppressActive, props.previewActive, tabShape, props.tabsRef])
52
+ return stripRef
25
53
  }
26
54
 
27
55
  /** @public @author ddj 2026年10月14号 @param props Group callbacks and file view. @returns Accessible tab strip and drop target. */
28
56
  export function EditorPane(props: PaneProps): React.ReactElement {
29
57
  const { group } = props
58
+ const stripRef = useTabReveal(props)
30
59
  // 计划预览接管本组正文时,磁盘页签只保留可点击性,不再画选中态,避免同一可见区域出现两条下划线。
31
60
  const suppressActive = props.suppressActive === true
32
61
  /** @private @author ddj 2026年10月20号 @param tab File record. @returns Draggable tab with isolated close control. */
@@ -67,7 +96,7 @@ export function EditorPane(props: PaneProps): React.ReactElement {
67
96
  }
68
97
  return React.createElement('section', { className: 'edrv-group' + (props.focused ? ' edrv-group-focused' : ''), 'data-edrv-group': group.id, onPointerDown: focusEmpty },
69
98
  React.createElement('div', { className: 'edrv-tabs-row' },
70
- React.createElement('div', { className: 'edrv-tabs', role: 'tablist', 'data-edrv-group-tabs': group.id, ref: props.tabsRef }, group.tabs.map(renderTab), props.extras),
99
+ React.createElement('div', { className: 'edrv-tabs', role: 'tablist', 'data-edrv-group-tabs': group.id, ref: stripRef }, group.tabs.map(renderTab), props.extras),
71
100
  props.tools),
72
101
  React.createElement('div', { className: 'edrv-group-body', role: 'tabpanel' }, props.children))
73
102
  }
@@ -2134,19 +2134,6 @@ export function EditorView(props) {
2134
2134
  }
2135
2135
  }, [sessionId])
2136
2136
 
2137
- // 活动页签滚动可见(页签栏溢出时键盘切换/打开文件后把当前页签带回视野):
2138
- // 只调整页签栏自身 scrollLeft,不触发页面滚动。
2139
- React.useEffect(() => {
2140
- const host = tabsHostRef.current
2141
- if (!host) return
2142
- const el = host.querySelector?.('.edrv-tab-active')
2143
- if (!el) return
2144
- const left = el.offsetLeft
2145
- const right = left + el.offsetWidth
2146
- if (left < host.scrollLeft) host.scrollLeft = left
2147
- else if (right > host.scrollLeft + host.clientWidth) host.scrollLeft = right - host.clientWidth
2148
- }, [active, planActive, planTabs.length, tabs.length, rowOwner])
2149
-
2150
2137
  // 页签栏滚轮横向滚动(需求 3):页签栏溢出时,鼠标滚轮(含触控板纵向手势)横滚页签栏,
2151
2138
  // 不溢出时不接管(保持页面垂直滚动);Shift+滚轮交由浏览器原生横滚。详见 horizontalWheel.ts。
2152
2139
  React.useEffect(() => attachHorizontalWheel(tabsHostRef.current), [rowOwner])
@@ -4634,7 +4621,7 @@ export function EditorView(props) {
4634
4621
  const chrome = !floating && id === rowOwner
4635
4622
  // 计划预览占用的正文只会在焦点组里;承载页签行的组同时收起磁盘选中态,保证整屏只有计划页签一条下划线。
4636
4623
  const hideDiskActive = Boolean(planActive) && (chrome || focused)
4637
- return React.createElement(EditorPane, { key: id, group, focused, dirty: dirtyMap, suppressActive: hideDiskActive, tabsRef: chrome ? tabsHostRef : undefined, extras: chrome ? planTabExtras : undefined, tools: chrome ? rowTools : undefined, onSelect: selectGroup, onClose: closeTab, onMenu: paneMenu, onDrag: dragTab, consumeClick: consumeDrag },
4624
+ return React.createElement(EditorPane, { key: id, group, focused, dirty: dirtyMap, suppressActive: hideDiskActive, previewActive: chrome ? planActive : undefined, tabsRef: chrome ? tabsHostRef : undefined, extras: chrome ? planTabExtras : undefined, tools: chrome ? rowTools : undefined, onSelect: selectGroup, onClose: closeTab, onMenu: paneMenu, onDrag: dragTab, consumeClick: consumeDrag },
4638
4625
  focused ? React.createElement('div', { className: 'edrv-full-slot', ref: mountFull }) : React.createElement(React.Fragment, null,
4639
4626
  React.createElement(GroupPathbar, { path: group.active, onFocus: () => selectGroup(id) }),
4640
4627
  React.createElement(PassiveEditor, { key: JSON.stringify([scope, sessionId, group.active]), path: group.active, groupId: id, mount: passiveMount })))
@@ -0,0 +1,64 @@
1
+ /** Group-local active tab visibility. @author ddj 2026年11月05号 */
2
+
3
+ /**
4
+ * Reveal the selected tab without moving the page or keyboard focus.
5
+ * @public @author ddj 2026年11月05号
6
+ * @param host Tab strip belonging to one editor group.
7
+ * @sideEffects Updates only the strip's horizontal scroll position.
8
+ */
9
+ export function revealTab(host: HTMLDivElement): void {
10
+ const tab = host.querySelector<HTMLElement>('.edrv-tab-active')
11
+ if (!tab || host.clientWidth <= 0) return
12
+
13
+ // DOM rectangles share viewport coordinates even when offsetParent is outside the strip.
14
+ const stripRect = host.getBoundingClientRect()
15
+ const tabRect = tab.getBoundingClientRect()
16
+ const left = stripRect.left + host.clientLeft
17
+ const right = left + host.clientWidth
18
+ let delta = 0
19
+ if (tabRect.width > host.clientWidth || tabRect.left < left) delta = tabRect.left - left
20
+ else if (tabRect.right > right) delta = tabRect.right - right
21
+ if (Math.abs(delta) < 0.5) return
22
+
23
+ const maximum = Math.max(0, host.scrollWidth - host.clientWidth)
24
+ const next = Math.max(0, Math.min(maximum, host.scrollLeft + delta))
25
+ if (next !== host.scrollLeft) host.scrollLeft = next
26
+ }
27
+
28
+ /**
29
+ * Observe geometry changes, not scrolling, so manual tab browsing remains possible.
30
+ * @public @author ddj 2026年11月05号
31
+ * @param host Group tab strip after its DOM commit.
32
+ * @returns Cleanup cancelling pending work and disconnecting geometry observation.
33
+ */
34
+ export function watchTabReveal(host: HTMLDivElement): () => void {
35
+ const view = host.ownerDocument.defaultView
36
+ let frame: number | undefined
37
+ let disposed = false
38
+ /** @private @author ddj 2026年11月05号 Reveal the latest selected tab after layout. */
39
+ function measure(): void {
40
+ frame = undefined
41
+ if (!disposed) revealTab(host)
42
+ }
43
+ /** @private @author ddj 2026年11月05号 Coalesce resize notifications into one layout read. */
44
+ function schedule(): void {
45
+ if (disposed || frame !== undefined || !view) return
46
+ frame = view.requestAnimationFrame(measure)
47
+ }
48
+
49
+ revealTab(host)
50
+ schedule()
51
+ const observer = typeof ResizeObserver === 'function' ? new ResizeObserver(schedule) : undefined
52
+ observer?.observe(host)
53
+ const tab = host.querySelector<HTMLElement>('.edrv-tab-active')
54
+ if (tab) observer?.observe(tab)
55
+
56
+ /** @private @author ddj 2026年11月05号 Cancel work owned by the previous selection or pane. */
57
+ function dispose(): void {
58
+ disposed = true
59
+ observer?.disconnect()
60
+ if (frame !== undefined) view?.cancelAnimationFrame(frame)
61
+ frame = undefined
62
+ }
63
+ return dispose
64
+ }