dsh-ris-ide 1.6.8 → 1.6.10
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 +5 -4
- package/lib/client.js +321 -118
- package/lib/index.js +13 -5
- package/package.json +2 -2
- package/test/client-viewer.test.mjs +152 -13
package/README.md
CHANGED
|
@@ -25,14 +25,14 @@ DSH(DeepSeek Harness)Web GUI 右侧栏里的 **RIS-IDE 本地开发面板**
|
|
|
25
25
|
|
|
26
26
|
## 功能
|
|
27
27
|
|
|
28
|
-
- **日志实时跟随**:`.log` 不停在打开那一刻;按行着色(ANSI / ERROR-WARN-INFO
|
|
28
|
+
- **日志实时跟随**:`.log` 不停在打开那一刻;按行着色(ANSI / ERROR-WARN-INFO)、自动换行(标题栏的换行开关真正在 `pre-wrap`/`pre` 之间切换,关掉就是横向滚动)、字号调节、暂停/到底;默认**只看本次启动**(重启后自动切到新一段),历史仍可加载。启动/停止/重启/调试后日志面板会**立刻补齐**(不再停在启动命令行上、等下一次重连才刷新),点项目行也不再是「唯一能让它动一下」的办法。日志标题栏显示服务状态(`运行中 (pid N)` / `已停止`),可直接停止服务。编辑器与日志的滚动条在内容溢出时**常驻可见**(不再是宿主题那条几乎看不见的 5px 细缝)。
|
|
29
29
|
- **侧栏「RIS控制台」**:右侧栏的面板只保留**控制台 + 实时日志**上下两段——上面每行一个程序(状态点 / 内存 / ▶ ■ / 🐞),点程序名(或整行任意位置)下面就跟它的日志;分隔条可拖动,**默认 240px**、双击恢复、高度会记住;两段标题栏各有 **⤢ 最大化/还原**,日志标题栏还有 **A− / A+ 字号**(与 IDE 日志窗格共用一份偏好)与 **跟随/暂停**。文件树 / 编辑器 / 调试都在独立窗口里,面板自身很轻、能一直挂着。
|
|
30
30
|
- **独立窗口**:聊天页右上角(VS Code 按钮右侧)的 **⧉ RIS-IDE** 按钮可在自己的窗口里打开完整工作台(面板右上角也有同样入口),**打开即填满屏幕**(按工作区尺寸定位到 0,0,不再是固定 1500×960)——该窗口**不加载 DSH 界面、不带会话**(只用插件自己的约 435KB 客户端 + DSH 提供的 React + 一条 SSE),长期开着也不随会话历史变重;与侧栏面板是同一条 `/dsh-ris-ide/*` 路由、同一个 cookie,没有新端口。窗口名按工作空间固定,再点只聚焦复用同一个窗口;窗口名按工作空间(而非当前目录)固定,所以从程序目录进调试也不会开出第二个窗口;若确实检测到另一个窗口,会提示「关闭这个窗口 / 仍然在这里打开」,不会自动关。
|
|
31
31
|
- **本地实例**:扫描工作区里的 Spring Boot 入口与前端 `package.json` 脚本,一键**启动 / 停止 / 重启 / 看日志**(启停未返回前该行盖上 loading 遮罩,点不到第二次);首次打开自动生成 `.dsh-ris-ide.json` 保存启动参数(JVM 参数、env、日志名、停止宽限),之后按配置启动,配置漂移时提示更新。
|
|
32
32
|
- **JDWP 调试(仅 Java)**:点行号加断点、双击红点删除(空行与注释行自动忽略);启动/调试时日志自动跟随该程序(其它窗口也会跟着切),F8 连按不会报取栈失败;调试自动打开的文件在调试行离开后自动关闭(有未保存修改的保留),断点列表与调用栈用类名标识位置,断点信息全局同步(其它程序的历史点不会残留、取消后立即消失);断点 / 线程 / 调用栈 / 变量 / 单步 / 继续;对象与数组变量可点开懒加载查看(含继承字段、空值也列出;步进刷新后展开状态保留),基础类型不显示展开图标;依赖 jar 里的类会自动从 `-sources.jar` 提取源码、否则用 `javap` 反汇编,也可在调试面板 ⚙ 里**可选**填一个反编译工具 jar(如 CFR);缓存按依赖 jar 指纹失效(jar 重建即重取),并有 64MB/30 天上限自动回收;命中后自动切到「参数」页签,并打开源码、高亮当前行(行不在可见区时自动滚动居中;单步/继续后行号跟随),调试面板与 agent 共用同一个会话;前端程序只能启停和看日志。
|
|
33
|
-
- **文件树 + 编辑器**:git 口径的目录树与文件名搜索(结果显示工作空间相对路径、悬停看全路径;Ctrl+R
|
|
33
|
+
- **文件树 + 编辑器**:git 口径的目录树与文件名搜索(结果显示工作空间相对路径、悬停看全路径;Ctrl+R 有单行选区时直接搜该文本,**Ctrl+Shift+R 同 Ctrl+R**——不再触发浏览器硬刷新;结果下拉支持**上下键移动 + Enter 打开**,默认指向文件名完全匹配的那一行、否则第一行,移动高亮时搜索框的光标不受影响、可以接着打字(聚焦且输入为空时的「最近打开」下拉同样默认选中第一行、可上下键 + Enter);编辑器/日志里 Ctrl+F 会把选中的文本带入各自的查找框,不占用这个文件检索框)、选中树里的文件按 **Ctrl+C 复制、Ctrl+A 全选树**(光标不会跑进编辑器)、内置 CodeMirror(Java 等语法高亮;切换文件时页签自动滚入可视区、编辑器失焦后不残留全选色、点选区里的任何位置(含搜索命中的橙色块)当次就把光标放进去)、保存、新建/复制/移动/删除、多页签、拖放移动(拖到**文件**上 = 移到该文件所在目录)、从系统粘贴/拖入文件导入;`src/main/java` 下可直接**新建包名**(`cn.com.x` 按点建多级目录),新建文件也只填一个名字(`cloud.test` 自动建包并补 `.java`);超过整读上限的大文本文件以**只读分页预览**打开(滚到接近底部才取下一页,内存超上限后释放前面的内容、可从头重载,不能编辑)。
|
|
34
34
|
- **文件树自动跟随**:工作区里新建/删除/重命名会经侧栏**同一条 SSE**自动更新,只重读变化的目录、行没变就不重绘;标题栏 **⟳** 可强制按 git 口径重新读取(结果会弹提示)。
|
|
35
|
-
- **预览与复制粘贴**:`.md/.markdown/.html/.htm`
|
|
35
|
+
- **预览与复制粘贴**:`.md/.markdown/.html/.htm` 在编辑区域上方有「预览」开关(点后编辑器变预览、按钮变「编辑」,预览当前内容含未保存修改);树右键「复制」是普通复制(树顶不再有剪贴板横条),粘贴到**文件**上 = 粘进它所在目录,遇到同名直接弹「粘贴为」要求**改个文件名**(预填「A - 副本.java」;复制贴回自身也同样走改名,等于生成副本);从系统文件管理器复制/拖入的文件可直接导入当前目录(`/fs/upload` 原始字节、`/fs/import` 路径导入)。
|
|
36
36
|
- **给 agent 用**:内置 `ris_dev_*` 工具(列程序 / 状态 / 启动 / 重启 / 停止 / 读日志 / 调试 / 安装 skill),agent 可以直接操作同一个面板。
|
|
37
37
|
- **跨平台**:Linux / macOS 用 bash 包装;Windows 自动选 Git Bash 或原生 PowerShell 包装(`taskkill /T` 杀整棵进程树)。
|
|
38
38
|
|
|
@@ -117,7 +117,8 @@ dsh plugin --profile web remove dsh-ris-ide # 同时移除 bundles 条目
|
|
|
117
117
|
## 源码与镜像
|
|
118
118
|
|
|
119
119
|
- Gitee(主仓库):<https://gitee.com/riscloud/dsh-ris-ide>
|
|
120
|
-
- GitHub(只读镜像,每
|
|
120
|
+
- GitHub(只读镜像,每 2 小时从 Gitee 自动同步):<https://github.com/ris-cloud/dsh-ris-ide>——请勿在 GitHub 侧提交,会被下一次同步覆盖。
|
|
121
|
+
- npm 包的 `repository` 字段指向 GitHub 镜像:npm 的 OIDC 可信发布会自动生成 provenance,要求 `repository` 与构建所在的 GitHub 仓库一致;源码仍以 Gitee 为准(`homepage`/`bugs` 与本文档均指向 Gitee)。
|
|
121
122
|
|
|
122
123
|
## 开发
|
|
123
124
|
|
package/lib/client.js
CHANGED
|
@@ -233,6 +233,8 @@ window.__ModuleLoader__.load({
|
|
|
233
233
|
var subscribers = new Set()
|
|
234
234
|
var source = null
|
|
235
235
|
var signature = ''
|
|
236
|
+
/** The tail path the CURRENT connection carries ('' when none). */
|
|
237
|
+
var servedTail = ''
|
|
236
238
|
var rebuildTimer = null
|
|
237
239
|
var retryTimer = null
|
|
238
240
|
var retryDelay = 3000
|
|
@@ -265,9 +267,17 @@ window.__ModuleLoader__.load({
|
|
|
265
267
|
})
|
|
266
268
|
topics.sort()
|
|
267
269
|
var next = topics.join(',') + '|' + [sessionId || '', cwd || '', tail || '', tailBytes || '', debugPath || ''].join('|')
|
|
268
|
-
if (source !== null && next === signature)
|
|
270
|
+
if (source !== null && next === signature) {
|
|
271
|
+
// Same shape as the live socket — but a viewer may have JOINED it since,
|
|
272
|
+
// and the host picked its tail path when it connected. Report that path
|
|
273
|
+
// so a viewer wanting another file can fall back to polling instead of
|
|
274
|
+
// sitting on a stream that carries someone else's text.
|
|
275
|
+
notifyOpen()
|
|
276
|
+
return
|
|
277
|
+
}
|
|
269
278
|
closeSource()
|
|
270
279
|
signature = next
|
|
280
|
+
servedTail = tail || ''
|
|
271
281
|
var url = routeUrl('dsh-ris-ide/stream')
|
|
272
282
|
url.searchParams.set('topics', topics.join(','))
|
|
273
283
|
if (sessionId !== undefined) url.searchParams.set('sessionId', sessionId)
|
|
@@ -279,9 +289,7 @@ window.__ModuleLoader__.load({
|
|
|
279
289
|
source.addEventListener('open', function () {
|
|
280
290
|
failures = 0
|
|
281
291
|
retryDelay = 3000
|
|
282
|
-
|
|
283
|
-
if (typeof sub.onOpen === 'function') sub.onOpen()
|
|
284
|
-
})
|
|
292
|
+
notifyOpen()
|
|
285
293
|
})
|
|
286
294
|
source.onerror = function () {
|
|
287
295
|
// EventSource retries by itself; tell subscribers so a panel that needs a
|
|
@@ -316,6 +324,12 @@ window.__ModuleLoader__.load({
|
|
|
316
324
|
})
|
|
317
325
|
})
|
|
318
326
|
}
|
|
327
|
+
/** Tell subscribers the connection is up, and WHICH tail it carries. */
|
|
328
|
+
function notifyOpen() {
|
|
329
|
+
subscribers.forEach(function (sub) {
|
|
330
|
+
if (typeof sub.onOpen === 'function') sub.onOpen({ tail: servedTail })
|
|
331
|
+
})
|
|
332
|
+
}
|
|
319
333
|
function scheduleRetry() {
|
|
320
334
|
if (retryTimer !== null || subscribers.size === 0) return
|
|
321
335
|
retryTimer = setTimeout(function () {
|
|
@@ -361,6 +375,8 @@ window.__ModuleLoader__.load({
|
|
|
361
375
|
window.addEventListener('focus', reconnectIfDown)
|
|
362
376
|
}
|
|
363
377
|
RIS_STREAM_HUB = {
|
|
378
|
+
/** The tail path the live connection is following ('' when none). */
|
|
379
|
+
tailPath: function () { return servedTail },
|
|
364
380
|
/**
|
|
365
381
|
* @param {{topics: string[], sessionId?: string, cwd?: string, handlers: object, onOpen?: Function}} sub - the subscription.
|
|
366
382
|
* @returns {Function} unsubscribe.
|
|
@@ -1116,6 +1132,14 @@ window.__ModuleLoader__.load({
|
|
|
1116
1132
|
flex: 1, minHeight: 0, margin: 0, padding: '6px 8px', overflow: 'auto',
|
|
1117
1133
|
tabSize: 4, lineHeight: 1.5, overflowWrap: 'anywhere',
|
|
1118
1134
|
},
|
|
1135
|
+
/**
|
|
1136
|
+
* The wrap toggle used to be a dead button: neither style existed, so both
|
|
1137
|
+
* modes rendered with the browser default and nothing changed. `pre` keeps
|
|
1138
|
+
* the log's own long lines intact and lets the body scroll horizontally;
|
|
1139
|
+
* `pre-wrap` breaks them at the pane edge.
|
|
1140
|
+
*/
|
|
1141
|
+
logWrap: { whiteSpace: 'pre-wrap', overflowWrap: 'anywhere', wordBreak: 'break-word' },
|
|
1142
|
+
logPre: { whiteSpace: 'pre', overflowWrap: 'normal', wordBreak: 'normal' },
|
|
1119
1143
|
line: { minHeight: '1.5em' },
|
|
1120
1144
|
timestamp: { opacity: 0.55 },
|
|
1121
1145
|
level: { fontWeight: 600 },
|
|
@@ -1241,6 +1265,8 @@ window.__ModuleLoader__.load({
|
|
|
1241
1265
|
display: 'flex', gap: 4, alignItems: 'center', padding: '1px 6px', cursor: 'pointer',
|
|
1242
1266
|
whiteSpace: 'nowrap', overflow: 'hidden',
|
|
1243
1267
|
},
|
|
1268
|
+
/** The row under the dropdown's keyboard/hover highlight (same box, tinted). */
|
|
1269
|
+
searchRowOn: { background: 'color-mix(in srgb, currentColor 18%, transparent)' },
|
|
1244
1270
|
editorPaneHead: {
|
|
1245
1271
|
display: 'flex', alignItems: 'center', gap: 4, padding: '1px 4px', flex: '0 0 auto',
|
|
1246
1272
|
// NOT `overflow: hidden`: this row is the search box's anchor, and clipping it
|
|
@@ -1786,7 +1812,11 @@ window.__ModuleLoader__.load({
|
|
|
1786
1812
|
tail: path,
|
|
1787
1813
|
tailBytes: TAIL_BYTES,
|
|
1788
1814
|
handlers: {
|
|
1789
|
-
tail: function (payload) {
|
|
1815
|
+
tail: function (payload) {
|
|
1816
|
+
// Another viewer's snapshot (two panes, one socket): ignore it.
|
|
1817
|
+
if (payload !== null && payload !== undefined && typeof payload.path === 'string' && payload.path !== path) return
|
|
1818
|
+
setView(stateFromPayload(payload))
|
|
1819
|
+
},
|
|
1790
1820
|
append: function (payload) {
|
|
1791
1821
|
var text = typeof payload.text === 'string' ? payload.text : ''
|
|
1792
1822
|
if (text === '') return
|
|
@@ -1830,9 +1860,14 @@ window.__ModuleLoader__.load({
|
|
|
1830
1860
|
})
|
|
1831
1861
|
},
|
|
1832
1862
|
},
|
|
1833
|
-
onOpen: function () {
|
|
1863
|
+
onOpen: function (info) {
|
|
1834
1864
|
failures = 0
|
|
1835
|
-
|
|
1865
|
+
// The panel shares ONE streaming socket and that socket carries ONE
|
|
1866
|
+
// tail path. When the host bound it to another file (another log viewer
|
|
1867
|
+
// mounted first), this pane would never see its own file on the stream
|
|
1868
|
+
// — poll `/tail` for it instead of waiting forever.
|
|
1869
|
+
var served = info !== null && info !== undefined && typeof info.tail === 'string' ? info.tail : ''
|
|
1870
|
+
setStreamOk(served === '' || served === path)
|
|
1836
1871
|
},
|
|
1837
1872
|
onError: function (readyState) {
|
|
1838
1873
|
failures += 1
|
|
@@ -1842,6 +1877,17 @@ window.__ModuleLoader__.load({
|
|
|
1842
1877
|
})
|
|
1843
1878
|
}, [tailVisible, streamOk, path, sessionId, cwd, props.customData])
|
|
1844
1879
|
|
|
1880
|
+
useEffect(function () {
|
|
1881
|
+
// First paint: read the tail once even when the shared stream is already
|
|
1882
|
+
// connected. A live connection only pushes what is written from NOW on, so
|
|
1883
|
+
// a pane mounting onto an existing socket would start empty and stay behind
|
|
1884
|
+
// (the "log freezes on the start command until I click the row" bug).
|
|
1885
|
+
if (!tailVisible) return
|
|
1886
|
+
if (props.customData !== undefined) return
|
|
1887
|
+
if (typeof EventSource !== 'function') return
|
|
1888
|
+
void refresh()
|
|
1889
|
+
}, [])
|
|
1890
|
+
|
|
1845
1891
|
useEffect(function () {
|
|
1846
1892
|
// The stream is authoritative while it is connected; polling resumes only
|
|
1847
1893
|
// when it failed (old host, buffering proxy, tab restored from bfcache).
|
|
@@ -2265,16 +2311,17 @@ window.__ModuleLoader__.load({
|
|
|
2265
2311
|
*
|
|
2266
2312
|
* The panel must suppress both forms even while an editor/input has focus
|
|
2267
2313
|
* (Ctrl+R there would otherwise reload the whole GUI and lose the IDE state).
|
|
2268
|
-
* @param {{key?: string, ctrlKey?: boolean, metaKey?: boolean, altKey?: boolean}} event - key facts.
|
|
2314
|
+
* @param {{key?: string, ctrlKey?: boolean, metaKey?: boolean, altKey?: boolean, shiftKey?: boolean}} event - key facts.
|
|
2269
2315
|
* @returns {boolean} true for Ctrl/Cmd+R and Ctrl/Cmd+Shift+R.
|
|
2270
2316
|
*/
|
|
2271
2317
|
function isBrowserReloadChord(event) {
|
|
2272
2318
|
var facts = event === undefined || event === null ? {} : event
|
|
2273
2319
|
var meta = facts.ctrlKey === true || facts.metaKey === true
|
|
2274
|
-
if (!meta || facts.altKey === true
|
|
2320
|
+
if (!meta || facts.altKey === true) return false
|
|
2275
2321
|
var key = String(facts.key === undefined || facts.key === null ? '' : facts.key).toLowerCase()
|
|
2276
|
-
//
|
|
2277
|
-
//
|
|
2322
|
+
// Both forms are the IDE's: plain Ctrl+R is the find chord, and Ctrl+Shift+R
|
|
2323
|
+
// (the browser's hard reload) is swallowed by the same net so it cannot throw
|
|
2324
|
+
// the IDE away. event.key is 'R' while Shift is held, hence toLowerCase().
|
|
2278
2325
|
return key === 'r'
|
|
2279
2326
|
}
|
|
2280
2327
|
|
|
@@ -2344,24 +2391,17 @@ window.__ModuleLoader__.load({
|
|
|
2344
2391
|
return DSH_CHORDS.has(chord)
|
|
2345
2392
|
}
|
|
2346
2393
|
|
|
2347
|
-
/**
|
|
2348
|
-
* Whether the browser would treat the keydown as a reload.
|
|
2349
|
-
*
|
|
2350
|
-
* The panel must suppress both forms even while an editor/input has focus
|
|
2351
|
-
* (Ctrl+R there would otherwise reload the whole GUI and lose the IDE state).
|
|
2352
|
-
* @param {{key?: string, ctrlKey?: boolean, metaKey?: boolean, altKey?: boolean}} event - key facts.
|
|
2353
|
-
* @returns {boolean} true for Ctrl/Cmd+R and Ctrl/Cmd+Shift+R.
|
|
2354
|
-
*/
|
|
2355
|
-
|
|
2356
2394
|
/**
|
|
2357
2395
|
* Whether a keydown is the IDE's workspace-search chord (Ctrl/Cmd+R).
|
|
2396
|
+
*
|
|
2397
|
+
* Ctrl+Shift+R counts as the same chord: it is the browser's HARD reload, and a
|
|
2398
|
+
* reload would throw the whole IDE away, so it has to land in the search box too.
|
|
2358
2399
|
* Ctrl+F stays with the editor's own find panel.
|
|
2359
2400
|
* @param {object} event - a KeyboardEvent-like object.
|
|
2360
|
-
* @returns {boolean} true for Ctrl+R / Cmd+R
|
|
2401
|
+
* @returns {boolean} true for Ctrl+R / Cmd+R (Shift allowed).
|
|
2361
2402
|
*/
|
|
2362
2403
|
function isGlobalFindChord(event) {
|
|
2363
2404
|
var facts = event === undefined || event === null ? {} : event
|
|
2364
|
-
if (facts.shiftKey === true) return false
|
|
2365
2405
|
var key = String(facts.key === undefined || facts.key === null ? '' : facts.key).toLowerCase()
|
|
2366
2406
|
var meta = facts.ctrlKey === true || facts.metaKey === true
|
|
2367
2407
|
if (meta && facts.altKey !== true && key === GLOBAL_FIND_KEY) return true
|
|
@@ -2706,7 +2746,7 @@ window.__ModuleLoader__.load({
|
|
|
2706
2746
|
{ keys: 'Del', desc: '删除(移入回收站,可撤销)' },
|
|
2707
2747
|
{ keys: 'Ctrl+Z', desc: '撤销文件操作:删除 / 新建 / 粘贴 / 移动' },
|
|
2708
2748
|
{ keys: 'Ctrl+C / X / V', desc: '复制 / 剪切 / 粘贴' },
|
|
2709
|
-
{ keys: '拖放', desc: '
|
|
2749
|
+
{ keys: '拖放', desc: '拖到文件夹或文件上移动(文件 = 移到它所在目录);拖到树空白处移到工作区根' },
|
|
2710
2750
|
{ keys: '⟳ / ⌖', desc: '标题栏:刷新文件树 / 定位当前文件' },
|
|
2711
2751
|
],
|
|
2712
2752
|
},
|
|
@@ -2924,16 +2964,59 @@ window.__ModuleLoader__.load({
|
|
|
2924
2964
|
return segments.join('/')
|
|
2925
2965
|
}
|
|
2926
2966
|
|
|
2967
|
+
/**
|
|
2968
|
+
* The row the workspace-search dropdown highlights when results arrive.
|
|
2969
|
+
*
|
|
2970
|
+
* The host answers in `git ls-files` order, so the full file name the user typed
|
|
2971
|
+
* (`ModelHelper.java`) is not necessarily row 0 — the row whose NAME matches the
|
|
2972
|
+
* query exactly is what they mean, and only when there is none does row 0 win.
|
|
2973
|
+
* @param {{matches?: string[], dirs?: object}|null|undefined} hits - dropdown payload.
|
|
2974
|
+
* @param {string} query - the search box text.
|
|
2975
|
+
* @returns {number} index into `hits.matches`; -1 when there is nothing to highlight.
|
|
2976
|
+
*/
|
|
2977
|
+
function searchHitActiveIndex(hits, query) {
|
|
2978
|
+
var matches = hits !== null && hits !== undefined && Array.isArray(hits.matches) ? hits.matches : []
|
|
2979
|
+
if (matches.length === 0) return -1
|
|
2980
|
+
var wanted = String(query === undefined || query === null ? '' : query).trim().toLowerCase()
|
|
2981
|
+
if (wanted !== '') {
|
|
2982
|
+
var dirs = hits.dirs !== null && hits.dirs !== undefined && typeof hits.dirs === 'object' ? hits.dirs : {}
|
|
2983
|
+
for (var index = 0; index < matches.length; index += 1) {
|
|
2984
|
+
var path = String(matches[index] === undefined || matches[index] === null ? '' : matches[index])
|
|
2985
|
+
if (dirs[path] === true) continue
|
|
2986
|
+
if (fileBaseName(path).toLowerCase() === wanted) return index
|
|
2987
|
+
}
|
|
2988
|
+
}
|
|
2989
|
+
return 0
|
|
2990
|
+
}
|
|
2991
|
+
|
|
2927
2992
|
/**
|
|
2928
2993
|
* The toolbar search's dropdown: results hang directly UNDER the search box
|
|
2929
2994
|
* (an absolutely-positioned panel), not inside the tree. Clicking a file opens
|
|
2930
2995
|
* it and reveals it in the tree; clicking a directory just expands the tree to
|
|
2931
2996
|
* it. `hits` is `{matches, dirs}` or `{error}`; `null` renders nothing.
|
|
2997
|
+
*
|
|
2998
|
+
* The highlighted row is `props.active` (an index into `hits.matches`), owned by
|
|
2999
|
+
* the panel so the arrow keys work while the SEARCH BOX keeps focus: hovering a
|
|
3000
|
+
* row only reports itself (`props.onHover`), it never touches focus or the caret.
|
|
2932
3001
|
*/
|
|
2933
3002
|
function SearchResults(props) {
|
|
2934
3003
|
var S = stylesFor(props && typeof props.fontRatio === 'number' ? props.fontRatio : 1)
|
|
2935
3004
|
var hits = props.hits
|
|
2936
3005
|
var cwd = typeof props.cwd === 'string' ? props.cwd : ''
|
|
3006
|
+
var active = typeof props.active === 'number' ? props.active : -1
|
|
3007
|
+
// Keep the highlighted row inside the dropdown's OWN scroll box: the list is
|
|
3008
|
+
// `overflow:auto`, so its scrollTop moves and the page never scrolls.
|
|
3009
|
+
var listRef = useRef(null)
|
|
3010
|
+
useEffect(function () {
|
|
3011
|
+
var list = listRef.current
|
|
3012
|
+
if (list === null || list === undefined || typeof list.getBoundingClientRect !== 'function') return
|
|
3013
|
+
var row = typeof list.querySelector === 'function' ? list.querySelector('[data-search-hit-active="1"]') : null
|
|
3014
|
+
if (row === null) return
|
|
3015
|
+
var box = list.getBoundingClientRect()
|
|
3016
|
+
var rect = row.getBoundingClientRect()
|
|
3017
|
+
var next = revealScrollTop(rect.top, rect.bottom, box.top, box.bottom, list.scrollTop)
|
|
3018
|
+
if (next !== list.scrollTop) list.scrollTop = next
|
|
3019
|
+
}, [active, hits])
|
|
2937
3020
|
if (hits === null || hits === undefined) return null
|
|
2938
3021
|
var rows
|
|
2939
3022
|
if (hits.error !== undefined) {
|
|
@@ -2941,19 +3024,31 @@ window.__ModuleLoader__.load({
|
|
|
2941
3024
|
} else if (!Array.isArray(hits.matches) || hits.matches.length === 0) {
|
|
2942
3025
|
rows = [h('div', { key: 'none', style: S.idePlaceholder }, '没有匹配的文件')]
|
|
2943
3026
|
} else {
|
|
2944
|
-
rows = hits.matches.map(function (path) {
|
|
3027
|
+
rows = hits.matches.map(function (path, index) {
|
|
2945
3028
|
var isDir = hits.dirs !== undefined && hits.dirs !== null && hits.dirs[path] === true
|
|
3029
|
+
var isActive = index === active
|
|
2946
3030
|
return h('div', {
|
|
2947
|
-
key: path,
|
|
3031
|
+
key: path,
|
|
3032
|
+
style: isActive ? Object.assign({}, S.searchRow, S.searchRowOn) : S.searchRow,
|
|
3033
|
+
title: path,
|
|
2948
3034
|
'data-search-hit': isDir ? 'dir' : 'file',
|
|
2949
3035
|
'data-search-hit-path': path,
|
|
3036
|
+
'data-search-hit-active': isActive ? '1' : '0',
|
|
3037
|
+
onMouseEnter: function () { if (typeof props.onHover === 'function') props.onHover(index) },
|
|
2950
3038
|
onClick: function () { props.onPick(path, isDir) },
|
|
2951
3039
|
},
|
|
2952
3040
|
h('span', { style: { opacity: 0.55, flex: '0 0 auto' } }, isDir ? '▸' : '·'),
|
|
2953
3041
|
h('span', { style: { overflow: 'hidden', textOverflow: 'ellipsis' } }, displayWorkspacePath(path, cwd)))
|
|
2954
3042
|
})
|
|
2955
3043
|
}
|
|
2956
|
-
return h('div', {
|
|
3044
|
+
return h('div', {
|
|
3045
|
+
ref: listRef,
|
|
3046
|
+
style: S.searchDropdown, 'data-search-results': '1',
|
|
3047
|
+
// Swallow the mousedown so picking a row cannot blur the search box: the
|
|
3048
|
+
// caret stays put and the user can keep typing (same trick as the history
|
|
3049
|
+
// list above).
|
|
3050
|
+
onMouseDown: function (event) { event.preventDefault() },
|
|
3051
|
+
},
|
|
2957
3052
|
h('div', { style: S.searchHeader }, props.busy === true ? '检索中…' : ('匹配 ' + (hits.matches ? hits.matches.length : 0) + ' 个')),
|
|
2958
3053
|
rows)
|
|
2959
3054
|
}
|
|
@@ -3492,12 +3587,6 @@ window.__ModuleLoader__.load({
|
|
|
3492
3587
|
var [pendingDelete, setPendingDelete] = useState(null)
|
|
3493
3588
|
/** Clipboard for copy/cut: `{mode, path, isDir, name}`. */
|
|
3494
3589
|
var [clipboard, setClipboard] = useState(null)
|
|
3495
|
-
/**
|
|
3496
|
-
* A paste that collided with an existing entry: `{dir, name, source}`.
|
|
3497
|
-
* `source` is `{kind:'clipboard'|'file'|'path', …}`; the dialog offers 覆盖 /
|
|
3498
|
-
* 改名 / 取消, and 改名 reuses the shared prompt with `mode:'paste'`.
|
|
3499
|
-
*/
|
|
3500
|
-
var [pasteConflict, setPasteConflict] = useState(null)
|
|
3501
3590
|
var [selectedPath, setSelectedPath] = useState(null)
|
|
3502
3591
|
var [dropTarget, setDropTarget] = useState(null)
|
|
3503
3592
|
/** LIFO of invertible file operations (Ctrl+Z). Ref: no re-render needed. */
|
|
@@ -3747,8 +3836,14 @@ window.__ModuleLoader__.load({
|
|
|
3747
3836
|
}
|
|
3748
3837
|
var pasteDir = prompt.dir
|
|
3749
3838
|
var pasteSource = prompt.source
|
|
3839
|
+
// A colliding paste asked for a DIFFERENT name: keeping the old one
|
|
3840
|
+
// would just bounce back to this prompt forever.
|
|
3841
|
+
if (prompt.conflict !== undefined && name === prompt.conflict) {
|
|
3842
|
+
notify('「' + name + '」已存在,请改个名字')
|
|
3843
|
+
return
|
|
3844
|
+
}
|
|
3750
3845
|
setPrompt(null)
|
|
3751
|
-
await runPaste(pasteSource, pasteDir, name
|
|
3846
|
+
await runPaste(pasteSource, pasteDir, name)
|
|
3752
3847
|
return
|
|
3753
3848
|
}
|
|
3754
3849
|
if (prompt.mode === 'package') {
|
|
@@ -3837,8 +3932,13 @@ window.__ModuleLoader__.load({
|
|
|
3837
3932
|
}
|
|
3838
3933
|
|
|
3839
3934
|
function beginCopy(mode) {
|
|
3840
|
-
|
|
3841
|
-
|
|
3935
|
+
// Ctrl+C / Ctrl+X arrive with no context menu open, so resolve the entry
|
|
3936
|
+
// from the tree selection as well — the keyboard used to no-op silently
|
|
3937
|
+
// (only the right-click menu ever worked).
|
|
3938
|
+
var entry = treeMenu !== null && treeMenu.entry !== null && treeMenu.entry !== undefined
|
|
3939
|
+
? treeMenu.entry
|
|
3940
|
+
: (selectedPath === null ? null : findEntry(selectedPath))
|
|
3941
|
+
if (entry === null || entry === undefined) return
|
|
3842
3942
|
setClipboard({ mode: mode, path: entry.path, isDir: entry.isDir === true, name: entry.name || entry.path })
|
|
3843
3943
|
setTreeMenu(null)
|
|
3844
3944
|
notify((mode === 'copy' ? '已复制 ' : '已剪切 ') + (entry.name || entry.path))
|
|
@@ -3858,45 +3958,64 @@ window.__ModuleLoader__.load({
|
|
|
3858
3958
|
return ''
|
|
3859
3959
|
}
|
|
3860
3960
|
|
|
3961
|
+
/**
|
|
3962
|
+
* Park a colliding paste and ask for a different leaf name.
|
|
3963
|
+
*
|
|
3964
|
+
* A collision is not a failure and not a 覆盖 question: the source is still
|
|
3965
|
+
* on disk, so the only way forward is a new name. The prompt is prefilled with
|
|
3966
|
+
* the tree's own 副本 convention (`A.java` → `A - 副本.java`) and refuses to
|
|
3967
|
+
* resubmit the colliding name (see the prompt's `paste` branch).
|
|
3968
|
+
* @param {object} source - the paste source (`clipboard` | `file` | `path`).
|
|
3969
|
+
* @param {string} dir - absolute destination directory.
|
|
3970
|
+
* @param {string} name - the leaf name that already exists there.
|
|
3971
|
+
*/
|
|
3972
|
+
function parkPasteName(source, dir, name) {
|
|
3973
|
+
notify('「' + name + '」已存在,请改个名字')
|
|
3974
|
+
setPrompt({ mode: 'paste', dir: dir, ext: '', title: '粘贴为', source: source, conflict: name })
|
|
3975
|
+
setPromptName(duplicateName(name, false))
|
|
3976
|
+
}
|
|
3977
|
+
|
|
3861
3978
|
/**
|
|
3862
3979
|
* Perform ONE paste (tree clipboard, an uploaded `File`, or an outside path).
|
|
3863
3980
|
*
|
|
3864
|
-
* A collision does not just fail: it
|
|
3865
|
-
*
|
|
3866
|
-
*
|
|
3867
|
-
* not an error, and it must never be mistaken for "overwrite
|
|
3981
|
+
* A collision does not just fail: it opens the 粘贴为 prompt with a 副本 name,
|
|
3982
|
+
* because the source is still on disk and the only way forward is a different
|
|
3983
|
+
* leaf name. Pasting a CUT entry back into its own folder is silently ignored —
|
|
3984
|
+
* that is a no-op, not an error, and it must never be mistaken for "overwrite
|
|
3985
|
+
* the source". Pasting a COPY onto its own path is NOT a no-op either: it falls
|
|
3986
|
+
* through to the same prompt, i.e. "duplicate under a new name".
|
|
3868
3987
|
* @param {object} source - `{kind:'clipboard'}` | `{kind:'file', file}` |
|
|
3869
3988
|
* `{kind:'path', path}`.
|
|
3870
3989
|
* @param {string} dir - absolute destination directory.
|
|
3871
3990
|
* @param {string} [requestedName] - explicit leaf name (改名 flow), else derived.
|
|
3872
|
-
* @param {boolean} [overwrite] - the user already chose 覆盖.
|
|
3873
3991
|
* @returns {Promise<string|undefined>} the created path, or undefined.
|
|
3874
3992
|
*/
|
|
3875
|
-
async function runPaste(source, dir, requestedName
|
|
3993
|
+
async function runPaste(source, dir, requestedName) {
|
|
3876
3994
|
var name = pasteEntryName(source, requestedName)
|
|
3877
3995
|
if (name === '') return undefined
|
|
3878
3996
|
var trimmedDir = dir.replace(/[\\/]+$/, '')
|
|
3879
3997
|
var target = trimmedDir + '/' + name
|
|
3880
3998
|
var from = source.kind === 'clipboard' && clipboard !== null ? clipboard.path : ''
|
|
3881
|
-
if (source.kind === 'clipboard' && target === from) {
|
|
3882
|
-
// Cut → its own folder,
|
|
3999
|
+
if (source.kind === 'clipboard' && target === from && clipboard.mode !== 'copy') {
|
|
4000
|
+
// Cut → its own folder: a no-op, not an error. A copy onto its own path is
|
|
4001
|
+
// the user asking for a duplicate, so it falls through to the 409 below.
|
|
3883
4002
|
return undefined
|
|
3884
4003
|
}
|
|
3885
4004
|
try {
|
|
3886
4005
|
if (source.kind === 'clipboard') {
|
|
3887
4006
|
if (clipboard.mode === 'copy') {
|
|
3888
|
-
await fsCopyEntry(scope, from, dir, name
|
|
4007
|
+
await fsCopyEntry(scope, from, dir, name)
|
|
3889
4008
|
} else {
|
|
3890
|
-
await fsMoveEntry(scope, from, dir, name
|
|
4009
|
+
await fsMoveEntry(scope, from, dir, name)
|
|
3891
4010
|
}
|
|
3892
4011
|
} else if (source.kind === 'file') {
|
|
3893
|
-
await fsUpload(scope, dir, name, source.file
|
|
4012
|
+
await fsUpload(scope, dir, name, source.file)
|
|
3894
4013
|
} else {
|
|
3895
|
-
await fsImportPath(scope, dir, source.path, name
|
|
4014
|
+
await fsImportPath(scope, dir, source.path, name)
|
|
3896
4015
|
}
|
|
3897
4016
|
} catch (problem) {
|
|
3898
|
-
if (isExistsProblem(problem)
|
|
3899
|
-
|
|
4017
|
+
if (isExistsProblem(problem)) {
|
|
4018
|
+
parkPasteName(source, dir, name)
|
|
3900
4019
|
return undefined
|
|
3901
4020
|
}
|
|
3902
4021
|
notify('粘贴失败:' + messageOf(problem))
|
|
@@ -3927,31 +4046,14 @@ window.__ModuleLoader__.load({
|
|
|
3927
4046
|
/** Paste the tree's own clipboard into `dirPath`. */
|
|
3928
4047
|
async function pasteInto(dirPath) {
|
|
3929
4048
|
if (clipboard === null) return
|
|
3930
|
-
await runPaste({ kind: 'clipboard' }, dirPath, undefined
|
|
3931
|
-
}
|
|
3932
|
-
|
|
3933
|
-
/** The conflict dialog's 覆盖 button: run the parked paste destructively. */
|
|
3934
|
-
async function pasteConflictOverwrite() {
|
|
3935
|
-
if (pasteConflict === null) return
|
|
3936
|
-
var conflict = pasteConflict
|
|
3937
|
-
setPasteConflict(null)
|
|
3938
|
-
await runPaste(conflict.source, conflict.dir, conflict.name, true)
|
|
3939
|
-
}
|
|
3940
|
-
|
|
3941
|
-
/** The conflict dialog's 改名 button: reopen the name prompt for THIS paste. */
|
|
3942
|
-
function pasteConflictRename() {
|
|
3943
|
-
if (pasteConflict === null) return
|
|
3944
|
-
var conflict = pasteConflict
|
|
3945
|
-
setPasteConflict(null)
|
|
3946
|
-
setPrompt({ mode: 'paste', dir: conflict.dir, ext: '', title: '粘贴为', source: conflict.source })
|
|
3947
|
-
setPromptName(conflict.name)
|
|
4049
|
+
await runPaste({ kind: 'clipboard' }, dirPath, undefined)
|
|
3948
4050
|
}
|
|
3949
4051
|
|
|
3950
4052
|
/**
|
|
3951
4053
|
* Import OS-clipboard content (a `paste` with no tree clipboard): `File`
|
|
3952
4054
|
* blobs go up as raw bytes, `file://`/path text goes through `/fs/import`.
|
|
3953
|
-
* Files that already exist stop at the first collision and
|
|
3954
|
-
*
|
|
4055
|
+
* Files that already exist stop at the first collision and open the same
|
|
4056
|
+
* 粘贴为 prompt as a tree paste.
|
|
3955
4057
|
* @param {string} dir - absolute destination directory.
|
|
3956
4058
|
* @param {File[]} files - pasted blobs (may be empty).
|
|
3957
4059
|
* @param {string[]} paths - parseClipboardPaths() result (may be empty).
|
|
@@ -3963,7 +4065,7 @@ window.__ModuleLoader__.load({
|
|
|
3963
4065
|
var source = index < files.length
|
|
3964
4066
|
? { kind: 'file', file: files[index] }
|
|
3965
4067
|
: { kind: 'path', path: paths[index - files.length] }
|
|
3966
|
-
var created = await runPaste(source, dir, undefined
|
|
4068
|
+
var created = await runPaste(source, dir, undefined)
|
|
3967
4069
|
if (created === undefined) break
|
|
3968
4070
|
imported += 1
|
|
3969
4071
|
}
|
|
@@ -4100,6 +4202,13 @@ window.__ModuleLoader__.load({
|
|
|
4100
4202
|
void undoLast()
|
|
4101
4203
|
return
|
|
4102
4204
|
}
|
|
4205
|
+
if (meta && (event.key === 'a' || event.key === 'A')) {
|
|
4206
|
+
// The tree is single-selection, so 全选 has nothing to expand into.
|
|
4207
|
+
// Claim the key anyway: unclaimed, the browser selected the whole page
|
|
4208
|
+
// and the following Ctrl+C copied that page text instead of the file.
|
|
4209
|
+
event.preventDefault()
|
|
4210
|
+
return
|
|
4211
|
+
}
|
|
4103
4212
|
if (meta && (event.key === 'c' || event.key === 'C')) {
|
|
4104
4213
|
event.preventDefault()
|
|
4105
4214
|
beginCopy('copy')
|
|
@@ -4197,7 +4306,10 @@ window.__ModuleLoader__.load({
|
|
|
4197
4306
|
var isRevealed = reveal !== null && reveal.path === entry.path
|
|
4198
4307
|
var isSelected = selectedPath === entry.path
|
|
4199
4308
|
&& (entry.isDir === true || !Array.isArray(props.openFiles) || props.openFiles.indexOf(entry.path) !== -1)
|
|
4200
|
-
|
|
4309
|
+
// Dropping ON a file means "into the folder that file lives in" — a row
|
|
4310
|
+
// is always a drop target; only the expand/collapse toggle is dir-only.
|
|
4311
|
+
var dropDir = entry.isDir === true ? entry.path : parentOf(entry.path)
|
|
4312
|
+
var isDropTarget = dropTarget === entry.path
|
|
4201
4313
|
out.push(h('div', {
|
|
4202
4314
|
key: entry.path,
|
|
4203
4315
|
style: Object.assign({}, isActive || isRevealed || isSelected ? S.treeRowOn : S.treeRow, {
|
|
@@ -4219,30 +4331,30 @@ window.__ModuleLoader__.load({
|
|
|
4219
4331
|
}
|
|
4220
4332
|
setSelectedPath(entry.path)
|
|
4221
4333
|
},
|
|
4222
|
-
onDragOver:
|
|
4334
|
+
onDragOver: function (event) {
|
|
4223
4335
|
event.preventDefault()
|
|
4224
4336
|
try { event.dataTransfer.dropEffect = 'move' } catch { /* ignore */ }
|
|
4225
4337
|
if (dropTarget !== entry.path) setDropTarget(entry.path)
|
|
4226
|
-
}
|
|
4227
|
-
onDragLeave:
|
|
4338
|
+
},
|
|
4339
|
+
onDragLeave: function () {
|
|
4228
4340
|
if (dropTarget === entry.path) setDropTarget(null)
|
|
4229
|
-
}
|
|
4230
|
-
onDrop:
|
|
4341
|
+
},
|
|
4342
|
+
onDrop: function (event) {
|
|
4231
4343
|
event.preventDefault()
|
|
4232
4344
|
event.stopPropagation()
|
|
4233
4345
|
var external = []
|
|
4234
4346
|
try { external = Array.prototype.slice.call(event.dataTransfer.files || []) } catch { external = [] }
|
|
4235
4347
|
if (external.length > 0) {
|
|
4236
|
-
void importExternal(
|
|
4348
|
+
void importExternal(dropDir, external, [])
|
|
4237
4349
|
setDropTarget(null)
|
|
4238
4350
|
return
|
|
4239
4351
|
}
|
|
4240
4352
|
var from = ''
|
|
4241
4353
|
try { from = event.dataTransfer.getData('text/plain') } catch { from = '' }
|
|
4242
4354
|
if (from === '') from = selectedPath === null ? '' : selectedPath
|
|
4243
|
-
if (from !== '' && from !== entry.path) void moveInto(from,
|
|
4355
|
+
if (from !== '' && from !== entry.path) void moveInto(from, dropDir)
|
|
4244
4356
|
setDropTarget(null)
|
|
4245
|
-
}
|
|
4357
|
+
},
|
|
4246
4358
|
onClick: function () {
|
|
4247
4359
|
setSelectedPath(entry.path)
|
|
4248
4360
|
toggle(entry)
|
|
@@ -4440,24 +4552,6 @@ window.__ModuleLoader__.load({
|
|
|
4440
4552
|
h('button', { type: 'button', style: Object.assign({}, S.button, { color: '#e5534b' }), 'data-tree-confirm-ok': '1', onClick: function () { void removeEntry(pendingDelete) } }, '删除'))))
|
|
4441
4553
|
}
|
|
4442
4554
|
|
|
4443
|
-
/** The paste-collision dialog: 覆盖 / 改名 / 取消. */
|
|
4444
|
-
function renderPasteConflict() {
|
|
4445
|
-
if (pasteConflict === null) return null
|
|
4446
|
-
var conflict = pasteConflict
|
|
4447
|
-
return h('div', {
|
|
4448
|
-
style: { position: 'fixed', inset: 0, zIndex: 950, background: 'rgba(0,0,0,0.32)', display: 'flex', alignItems: 'center', justifyContent: 'center' },
|
|
4449
|
-
'data-tree-paste-conflict': '1',
|
|
4450
|
-
onMouseDown: function (event) { if (event.target === event.currentTarget) setPasteConflict(null) },
|
|
4451
|
-
},
|
|
4452
|
-
h('div', { style: { width: 380, maxWidth: '92vw', background: 'Canvas', color: 'inherit', border: '1px solid color-mix(in srgb, currentColor 25%, transparent)', borderRadius: 6, boxShadow: '0 18px 48px rgba(0,0,0,0.4)', padding: 10, display: 'flex', flexDirection: 'column', gap: 8, fontFamily: 'system-ui, sans-serif', fontSize: 12 } },
|
|
4453
|
-
h('div', { style: { fontWeight: 600 } }, '已存在同名条目'),
|
|
4454
|
-
h('div', { style: { opacity: 0.75, wordBreak: 'break-all' } }, conflict.dir.replace(/[\\/]+$/, '') + '/' + conflict.name),
|
|
4455
|
-
h('div', { style: { display: 'flex', justifyContent: 'flex-end', gap: 6 } },
|
|
4456
|
-
h('button', { type: 'button', style: S.buttonOff, onClick: function () { setPasteConflict(null) } }, '取消'),
|
|
4457
|
-
h('button', { type: 'button', style: S.buttonOff, 'data-tree-paste-rename': '1', onClick: pasteConflictRename }, '改名…'),
|
|
4458
|
-
h('button', { type: 'button', style: Object.assign({}, S.button, { color: '#e5534b' }), 'data-tree-paste-overwrite': '1', onClick: function () { void pasteConflictOverwrite() } }, '覆盖'))))
|
|
4459
|
-
}
|
|
4460
|
-
|
|
4461
4555
|
return h('div', { style: S.treeWrap, 'data-ide-tree': '1' },
|
|
4462
4556
|
degraded === true && treeDismissals.isOpen('tree-degraded', 'v1')
|
|
4463
4557
|
? h(ClosableNotice, {
|
|
@@ -4476,10 +4570,6 @@ window.__ModuleLoader__.load({
|
|
|
4476
4570
|
onClick: function () { setError(undefined) },
|
|
4477
4571
|
}, '×'))
|
|
4478
4572
|
: null,
|
|
4479
|
-
clipboard === null
|
|
4480
|
-
? null
|
|
4481
|
-
: h('div', { style: Object.assign({}, S.meta, { padding: '0 6px 2px', opacity: 0.7 }), 'data-tree-clipboard': clipboard.mode },
|
|
4482
|
-
(clipboard.mode === 'copy' ? '已复制 ' : '已剪切 ') + clipboard.name + ' · Ctrl+V 粘贴'),
|
|
4483
4573
|
h('div', {
|
|
4484
4574
|
ref: treeListRef, style: Object.assign({}, S.treeList, { outline: 'none' }), 'data-tree-root': rootPath,
|
|
4485
4575
|
tabIndex: -1,
|
|
@@ -4500,8 +4590,7 @@ window.__ModuleLoader__.load({
|
|
|
4500
4590
|
}, rowsFor(rootPath, 0, {}, {})),
|
|
4501
4591
|
renderTreeMenu(),
|
|
4502
4592
|
renderTreePrompt(),
|
|
4503
|
-
renderTreeConfirm()
|
|
4504
|
-
renderPasteConflict())
|
|
4593
|
+
renderTreeConfirm())
|
|
4505
4594
|
}
|
|
4506
4595
|
|
|
4507
4596
|
/**
|
|
@@ -4838,14 +4927,40 @@ window.__ModuleLoader__.load({
|
|
|
4838
4927
|
var DEBUG_LINE_CSS = '[data-workbench="ris-ide"] .' + DEBUG_LINE_CLASS
|
|
4839
4928
|
+ '{background:color-mix(in srgb, #d29922 26%, transparent) !important;box-shadow:inset 2px 0 0 #d29922}'
|
|
4840
4929
|
|
|
4930
|
+
/**
|
|
4931
|
+
* Scrollbars in the IDE. The editor scrolls with plain `auto` overflow
|
|
4932
|
+
* (CM6's `.cm-scroller{overflowX:auto}` makes the other axis `auto` too): the
|
|
4933
|
+
* bars are classic, non-overlay and appear only when content overflows — which
|
|
4934
|
+
* is what we want. What they LOOK like, though, comes from the host theme
|
|
4935
|
+
* (5px wide, transparent track, near-invisible thumb), so an overflowing editor
|
|
4936
|
+
* shows a 5px sliver that reads as "no scrollbar at all". Give it a real one and
|
|
4937
|
+
* keep `auto`: neither `overflow-y:scroll` nor `scrollbar-gutter:stable` here —
|
|
4938
|
+
* both would reserve an empty gutter on files that do not overflow.
|
|
4939
|
+
*/
|
|
4940
|
+
var SCROLLBAR_CSS = '[data-workbench="ris-ide"] ::-webkit-scrollbar{width:10px;height:10px}'
|
|
4941
|
+
+ '[data-workbench="ris-ide"] ::-webkit-scrollbar-track{background:rgba(127,127,127,0.14);border-radius:999px}'
|
|
4942
|
+
+ '[data-workbench="ris-ide"] ::-webkit-scrollbar-thumb'
|
|
4943
|
+
+ '{background:rgba(86,182,194,0.55);border:2px solid transparent;border-radius:999px;background-clip:content-box}'
|
|
4944
|
+
+ '[data-workbench="ris-ide"] ::-webkit-scrollbar-thumb:hover{background:rgba(86,182,194,0.80);background-clip:content-box}'
|
|
4945
|
+
+ '[data-workbench="ris-ide"] ::-webkit-scrollbar-corner{background:0 0}'
|
|
4946
|
+
+ '@supports not selector(::-webkit-scrollbar){'
|
|
4947
|
+
+ '[data-workbench="ris-ide"] *{scrollbar-width:thin;scrollbar-color:rgba(86,182,194,0.65) rgba(127,127,127,0.14)}}'
|
|
4948
|
+
|
|
4841
4949
|
/**
|
|
4842
4950
|
* Selection colours for the embedded editor, injected from the panel itself.
|
|
4843
4951
|
* CodeMirror draws the selection into its own layer, and the page's stylesheet
|
|
4844
4952
|
* can win that fight — the result was "other matches are highlighted, the text
|
|
4845
4953
|
* I selected is not". The selected range is teal, the other matches amber, so
|
|
4846
4954
|
* the selection always reads as the stronger one.
|
|
4847
|
-
|
|
4848
|
-
|
|
4955
|
+
*
|
|
4956
|
+
* Raising the layer paints the selection ABOVE `.cm-content`, so it has to be
|
|
4957
|
+
* transparent to the pointer as well: the layer is a plain `<div>` spanning the
|
|
4958
|
+
* whole scroller (CM only does this for its cursor layer), and without
|
|
4959
|
+
* `pointer-events:none` a click on a highlighted range stopped there — the
|
|
4960
|
+
* caret never moved into the selection, nor into the amber "current match" of
|
|
4961
|
+
* the search panel (which is a selection too). Both needed a second click.
|
|
4962
|
+
*/
|
|
4963
|
+
var SELECTION_CSS = '[data-workbench="ris-ide"] .cm-selectionLayer{z-index:5 !important;pointer-events:none !important}'
|
|
4849
4964
|
// While anything is selected the active-line tint is switched off: it is
|
|
4850
4965
|
// painted on the line itself and used to hide the selection colour on the
|
|
4851
4966
|
// current line (both for a single range and for a multi-line selection).
|
|
@@ -5249,6 +5364,8 @@ var [ui, setUi] = useState(function () {
|
|
|
5249
5364
|
/** Dropdown payload for the toolbar search: null | {matches,dirs} | {error}. */
|
|
5250
5365
|
var [searchHits, setSearchHits] = useState(null)
|
|
5251
5366
|
var [searchBusy, setSearchBusy] = useState(false)
|
|
5367
|
+
/** Dropdown highlight: an index into `searchHits.matches`, -1 when there is none. */
|
|
5368
|
+
var [searchActive, setSearchActive] = useState(-1)
|
|
5252
5369
|
/** One-shot "reveal this hit in the tree" request (nonce makes repeats work). */
|
|
5253
5370
|
var [locateRequest, setLocateRequest] = useState(null)
|
|
5254
5371
|
var locateNonceRef = useRef(0)
|
|
@@ -5525,7 +5642,7 @@ var [ui, setUi] = useState(function () {
|
|
|
5525
5642
|
var parsed
|
|
5526
5643
|
try { parsed = JSON.parse(event.newValue) } catch (error) { return }
|
|
5527
5644
|
var path = parsed !== null && typeof parsed.path === 'string' ? parsed.path : ''
|
|
5528
|
-
if (path === ''
|
|
5645
|
+
if (path === '') return
|
|
5529
5646
|
var found
|
|
5530
5647
|
for (var index = 0; index < programs.length; index += 1) {
|
|
5531
5648
|
if (programs[index] !== null && programs[index] !== undefined && programs[index].logPath === path) {
|
|
@@ -5533,9 +5650,14 @@ var [ui, setUi] = useState(function () {
|
|
|
5533
5650
|
break
|
|
5534
5651
|
}
|
|
5535
5652
|
}
|
|
5536
|
-
if (found !== undefined)
|
|
5537
|
-
|
|
5538
|
-
|
|
5653
|
+
if (found !== undefined) selectProgram(found)
|
|
5654
|
+
else {
|
|
5655
|
+
setActivePath(path)
|
|
5656
|
+
activePathRef.current = path
|
|
5657
|
+
}
|
|
5658
|
+
// Even when the pane already shows this log: `selectProgram` is a no-op
|
|
5659
|
+
// for the same path, and the start that sent this broadcast may already
|
|
5660
|
+
// have written lines that no frame delivered. Re-read once.
|
|
5539
5661
|
setLogNonce(function (value) { return value + 1 })
|
|
5540
5662
|
}
|
|
5541
5663
|
window.addEventListener('storage', onStorage)
|
|
@@ -6053,6 +6175,12 @@ var [ui, setUi] = useState(function () {
|
|
|
6053
6175
|
// view has to switch at click time, not after the spawn settles.
|
|
6054
6176
|
selectProgram(program)
|
|
6055
6177
|
broadcastLogFocus(program.logPath)
|
|
6178
|
+
var logPath = typeof program.logPath === 'string' ? program.logPath : ''
|
|
6179
|
+
// Same first-output watch as the debug path. Without it the pane can sit on
|
|
6180
|
+
// the wrapper's marker/command line forever: a start's output arrives as
|
|
6181
|
+
// live frames onto an already-open stream, and one missed frame (or a
|
|
6182
|
+
// viewer mounted a moment too late) is never recovered by a snapshot.
|
|
6183
|
+
var baseline = logPath === '' ? undefined : await logSizeOf(logPath)
|
|
6056
6184
|
setUi(function (prev) { return Object.assign({}, prev, { busy: true, note: '' }) })
|
|
6057
6185
|
statusNote('正在启动 ' + program.name + '…', 0)
|
|
6058
6186
|
setConsoleBusy(program.id)
|
|
@@ -6063,6 +6191,10 @@ var [ui, setUi] = useState(function () {
|
|
|
6063
6191
|
setConsoleBusy('')
|
|
6064
6192
|
}
|
|
6065
6193
|
setUi(function (prev) { return Object.assign({}, prev, { busy: false }) })
|
|
6194
|
+
if (logPath !== '') {
|
|
6195
|
+
setLogNonce(function (value) { return value + 1 })
|
|
6196
|
+
watchLogOutput(logPath, baseline)
|
|
6197
|
+
}
|
|
6066
6198
|
if (result.ok !== true) return note('启动失败:' + result.error)
|
|
6067
6199
|
}
|
|
6068
6200
|
/** Any program with a pidfile can be stopped, frontend included. */
|
|
@@ -6680,6 +6812,15 @@ var [ui, setUi] = useState(function () {
|
|
|
6680
6812
|
return function () { cancelled = true; clearTimeout(timer) }
|
|
6681
6813
|
}, [treeQuery, cwd])
|
|
6682
6814
|
|
|
6815
|
+
/**
|
|
6816
|
+
* New results (and every keystroke) reset the highlight: the row whose file
|
|
6817
|
+
* name matches the query exactly, else the first row — so the dropdown opens
|
|
6818
|
+
* with a visible target and Enter is never a no-op.
|
|
6819
|
+
*/
|
|
6820
|
+
useEffect(function () {
|
|
6821
|
+
setSearchActive(searchHitActiveIndex(searchHits, treeQuery))
|
|
6822
|
+
}, [searchHits, treeQuery])
|
|
6823
|
+
|
|
6683
6824
|
/** A dropdown pick: open files, reveal either kind in the tree, close the list. */
|
|
6684
6825
|
function pickSearchHit(path, isDir) {
|
|
6685
6826
|
setTreeQuery('')
|
|
@@ -7637,6 +7778,19 @@ var [ui, setUi] = useState(function () {
|
|
|
7637
7778
|
// The editor pane's header IS the toolbar now (no workbench-level top bar):
|
|
7638
7779
|
// the search box grows, the fixed action group holds the layout/font/theme
|
|
7639
7780
|
// controls, and the pane's own maximiser stays at the far right.
|
|
7781
|
+
// Both dropdowns share ONE highlighted index (`searchActive`): the recent-file
|
|
7782
|
+
// list while the box is empty, the result list once a query is typed. Either
|
|
7783
|
+
// way the arrow keys move the ROW and never the caret, so typing can go on.
|
|
7784
|
+
var searchHistoryRows = searchFocused === true && treeQuery.trim() === ''
|
|
7785
|
+
? searchHistoryEntries(recentFiles, openFiles, SEARCH_RECENT_LIMIT)
|
|
7786
|
+
: []
|
|
7787
|
+
// Landing on the box highlights the first recent file, ready for Enter — the
|
|
7788
|
+
// same "default row" the result list gets from its own reset effect.
|
|
7789
|
+
useEffect(function () {
|
|
7790
|
+
if (searchHistoryRows.length === 0) return
|
|
7791
|
+
setSearchActive(0)
|
|
7792
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- keyed by list shape
|
|
7793
|
+
}, [searchFocused, treeQuery, searchHistoryRows.length])
|
|
7640
7794
|
var paneSearch = h('span', { style: S.searchWrap, 'data-search-box': '1' },
|
|
7641
7795
|
h('input', {
|
|
7642
7796
|
ref: searchInputRef,
|
|
@@ -7648,23 +7802,57 @@ var [ui, setUi] = useState(function () {
|
|
|
7648
7802
|
onFocus: function () { setSearchFocused(true) },
|
|
7649
7803
|
onBlur: function () { setSearchFocused(false) },
|
|
7650
7804
|
onKeyDown: function (event) {
|
|
7651
|
-
if (event.key === 'Escape') { event.preventDefault(); setTreeQuery(''); setSearchFocused(false) }
|
|
7805
|
+
if (event.key === 'Escape') { event.preventDefault(); setTreeQuery(''); setSearchFocused(false); return }
|
|
7806
|
+
// Whichever dropdown is open is the walkable list: the recent-file list
|
|
7807
|
+
// while the box is empty, the results once a query is typed.
|
|
7808
|
+
var matches = searchHits !== null && searchHits !== undefined && Array.isArray(searchHits.matches) ? searchHits.matches : []
|
|
7809
|
+
var inHistory = searchHistoryRows.length > 0
|
|
7810
|
+
var count = inHistory ? searchHistoryRows.length : matches.length
|
|
7811
|
+
if (count === 0) return
|
|
7812
|
+
if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {
|
|
7813
|
+
// The arrow moves the highlighted ROW, not the caret: the box keeps
|
|
7814
|
+
// focus and the cursor position, so typing can go on right after a look.
|
|
7815
|
+
event.preventDefault()
|
|
7816
|
+
var step = event.key === 'ArrowDown' ? 1 : -1
|
|
7817
|
+
setSearchActive(function (current) {
|
|
7818
|
+
var from = current >= 0 && current < count ? current : 0
|
|
7819
|
+
return (from + step + count) % count
|
|
7820
|
+
})
|
|
7821
|
+
return
|
|
7822
|
+
}
|
|
7823
|
+
if (event.key !== 'Enter') return
|
|
7824
|
+
event.preventDefault()
|
|
7825
|
+
var index = searchActive >= 0 && searchActive < count ? searchActive : 0
|
|
7826
|
+
if (inHistory) {
|
|
7827
|
+
var row = searchHistoryRows[index]
|
|
7828
|
+
if (row === undefined) return
|
|
7829
|
+
setTreeQuery('')
|
|
7830
|
+
setSearchFocused(false)
|
|
7831
|
+
void openRecentPath(row.path)
|
|
7832
|
+
return
|
|
7833
|
+
}
|
|
7834
|
+
var chosen = matches[index]
|
|
7835
|
+
pickSearchHit(chosen, searchHits.dirs !== undefined && searchHits.dirs !== null && searchHits.dirs[chosen] === true)
|
|
7652
7836
|
},
|
|
7653
7837
|
}),
|
|
7654
7838
|
searchFocused === true && treeQuery.trim() === ''
|
|
7655
7839
|
? (function () {
|
|
7656
|
-
|
|
7657
|
-
if (historyRows.length === 0) return null
|
|
7840
|
+
if (searchHistoryRows.length === 0) return null
|
|
7658
7841
|
return h('div', {
|
|
7659
7842
|
style: S.searchDropdown, 'data-search-history': '1',
|
|
7660
7843
|
// Keep the input focused so the blur does not eat the click.
|
|
7661
7844
|
onMouseDown: function (event) { event.preventDefault() },
|
|
7662
7845
|
},
|
|
7663
|
-
h('div', { style: S.searchHeader }, '最近打开 · ' +
|
|
7664
|
-
|
|
7846
|
+
h('div', { style: S.searchHeader }, '最近打开 · ' + searchHistoryRows.length + ' 个(↑↓ 选择,Enter 打开)'),
|
|
7847
|
+
searchHistoryRows.map(function (row, index) {
|
|
7848
|
+
var on = index === searchActive
|
|
7665
7849
|
return h('div', {
|
|
7666
|
-
key: 'history:' + row.path,
|
|
7850
|
+
key: 'history:' + row.path,
|
|
7851
|
+
style: on ? Object.assign({}, S.searchRow, S.searchRowOn) : S.searchRow,
|
|
7852
|
+
title: row.path,
|
|
7667
7853
|
'data-search-history-row': row.path,
|
|
7854
|
+
'data-search-history-active': on ? '1' : '0',
|
|
7855
|
+
onMouseEnter: function () { setSearchActive(index) },
|
|
7668
7856
|
onClick: function () {
|
|
7669
7857
|
setTreeQuery('')
|
|
7670
7858
|
setSearchFocused(false)
|
|
@@ -7675,7 +7863,11 @@ var [ui, setUi] = useState(function () {
|
|
|
7675
7863
|
h('span', { style: { overflow: 'hidden', textOverflow: 'ellipsis' } }, displayWorkspacePath(row.path, cwd)))
|
|
7676
7864
|
}))
|
|
7677
7865
|
})()
|
|
7678
|
-
: h(SearchResults, {
|
|
7866
|
+
: h(SearchResults, {
|
|
7867
|
+
hits: searchHits, busy: searchBusy, onPick: pickSearchHit,
|
|
7868
|
+
active: searchActive, onHover: setSearchActive,
|
|
7869
|
+
fontRatio: fontRatio, cwd: cwd,
|
|
7870
|
+
}))
|
|
7679
7871
|
// Panel-wide net: while the IDE is on screen the host's shortcut adapter and
|
|
7680
7872
|
// the browser's own context menu never see events that belong to this panel.
|
|
7681
7873
|
useEffect(function () {
|
|
@@ -7923,7 +8115,7 @@ var [ui, setUi] = useState(function () {
|
|
|
7923
8115
|
},
|
|
7924
8116
|
// The sidebar's CodeMirror theme pins 13px, so the embedded viewer needs
|
|
7925
8117
|
// this rule, not inheritance, to follow A−/A+.
|
|
7926
|
-
h('style', { key: 'ide-font' }, viewerFontCss(uiFont) + viewerThemeCss(pageDark) + DEBUG_LINE_CSS + PREVIEW_CSS + SELECTION_CSS + TOAST_CSS + PROGRAM_LOADING_CSS),
|
|
8118
|
+
h('style', { key: 'ide-font' }, viewerFontCss(uiFont) + viewerThemeCss(pageDark) + DEBUG_LINE_CSS + PREVIEW_CSS + SELECTION_CSS + SCROLLBAR_CSS + TOAST_CSS + PROGRAM_LOADING_CSS),
|
|
7927
8119
|
(function () {
|
|
7928
8120
|
var panes = {
|
|
7929
8121
|
tree: h(IdeTree, {
|
|
@@ -9904,6 +10096,11 @@ var [ui, setUi] = useState(function () {
|
|
|
9904
10096
|
|
|
9905
10097
|
function ProgramsPanel(props) {
|
|
9906
10098
|
var [active, setActive] = useState(function () { return pendingProgram })
|
|
10099
|
+
/**
|
|
10100
|
+
* Bumped when a start/stop may have moved this pane's log beyond the frames
|
|
10101
|
+
* already delivered: the log viewer re-reads the tail once (see `reloadNonce`).
|
|
10102
|
+
*/
|
|
10103
|
+
var [compactLogNonce, setCompactLogNonce] = useState(0)
|
|
9907
10104
|
useEffect(function () {
|
|
9908
10105
|
if (pendingProgram === null) return undefined
|
|
9909
10106
|
setActive(pendingProgram)
|
|
@@ -10061,7 +10258,7 @@ var [ui, setUi] = useState(function () {
|
|
|
10061
10258
|
// Show this program's log from the first moment: the start call waits for
|
|
10062
10259
|
// a pidfile (up to START_WAIT_MS), and Maven compile is silent. The same
|
|
10063
10260
|
// event moves the standalone IDE window's log pane right away.
|
|
10064
|
-
if (kind === 'start') { setActive(program); broadcastLogFocus(program.logPath) }
|
|
10261
|
+
if (kind === 'start') { setActive(program); broadcastLogFocus(program.logPath); setCompactLogNonce(function (value) { return value + 1 }) }
|
|
10065
10262
|
var scopeArg = { sessionId: sessionId, cwd: cwd }
|
|
10066
10263
|
var task = kind === 'start' ? requestStart(program.id, scopeArg) : requestStop(program.logPath, scopeArg)
|
|
10067
10264
|
task.then(function (result) {
|
|
@@ -10074,6 +10271,9 @@ var [ui, setUi] = useState(function () {
|
|
|
10074
10271
|
else if (result.alreadyStopped === true) note = program.name + ' 此前已停止'
|
|
10075
10272
|
else note = program.name + ' 已停止'
|
|
10076
10273
|
setState(function (prev) { return Object.assign({}, prev, { note: note }) })
|
|
10274
|
+
// The start/stop settled and the wrapper wrote its marker: re-read once
|
|
10275
|
+
// so the pane cannot stay on the pre-start text.
|
|
10276
|
+
setCompactLogNonce(function (value) { return value + 1 })
|
|
10077
10277
|
void refresh(false)
|
|
10078
10278
|
}).catch(function (error) {
|
|
10079
10279
|
setBusyId(undefined)
|
|
@@ -10423,6 +10623,8 @@ var [ui, setUi] = useState(function () {
|
|
|
10423
10623
|
fontSize: compactFont,
|
|
10424
10624
|
// A parked log pane must not poll `/tail` either.
|
|
10425
10625
|
visible: props.visible !== false && maxed !== 'console',
|
|
10626
|
+
// A start/stop that settled re-reads the tail once (see act()).
|
|
10627
|
+
reloadNonce: compactLogNonce,
|
|
10426
10628
|
})
|
|
10427
10629
|
: h('div', { style: S.compactEmpty }, '点上面的程序名,这里显示它的实时日志'))
|
|
10428
10630
|
)
|
|
@@ -10643,6 +10845,7 @@ var [ui, setUi] = useState(function () {
|
|
|
10643
10845
|
viewerThemeCss: viewerThemeCss,
|
|
10644
10846
|
stylesFor: stylesFor,
|
|
10645
10847
|
SearchResults: SearchResults,
|
|
10848
|
+
searchHitActiveIndex: searchHitActiveIndex,
|
|
10646
10849
|
mergeGlobalBreakpoints: mergeGlobalBreakpoints,
|
|
10647
10850
|
/** Test seam: seed the global breakpoint list (no host/session needed). */
|
|
10648
10851
|
__setGlobalBreakpoints: function (list) { GLOBAL_BREAKPOINTS = Array.isArray(list) ? list : [] },
|
package/lib/index.js
CHANGED
|
@@ -2815,15 +2815,18 @@ async function serveStream(ctx, req, res, options) {
|
|
|
2815
2815
|
let closed = false
|
|
2816
2816
|
const cleanups = []
|
|
2817
2817
|
const send = (event, payload) => {
|
|
2818
|
-
if (closed) return
|
|
2818
|
+
if (closed) return false
|
|
2819
2819
|
// Backpressure: a browser tab that is throttled (background/minimized) must
|
|
2820
|
-
// not make the host buffer log frames without bound.
|
|
2821
|
-
// next
|
|
2822
|
-
|
|
2820
|
+
// not make the host buffer log frames without bound. A dropped frame is NOT
|
|
2821
|
+
// recovered by the next tick — the tail tick only reads from `previousSize`
|
|
2822
|
+
// onwards — so the caller below re-snapshots instead of leaving a gap.
|
|
2823
|
+
if (shouldDropSseFrame(res.writableLength)) return false
|
|
2823
2824
|
try {
|
|
2824
2825
|
res.write(`event: ${event}\ndata: ${JSON.stringify(payload)}\n\n`)
|
|
2826
|
+
return true
|
|
2825
2827
|
} catch {
|
|
2826
2828
|
closed = true
|
|
2829
|
+
return false
|
|
2827
2830
|
}
|
|
2828
2831
|
}
|
|
2829
2832
|
send('hello', { ok: true, version: PKG_VERSION, root: cwd, topics })
|
|
@@ -3020,7 +3023,12 @@ async function serveStream(ctx, req, res, options) {
|
|
|
3020
3023
|
await snapshot()
|
|
3021
3024
|
return
|
|
3022
3025
|
}
|
|
3023
|
-
if (text !== ''
|
|
3026
|
+
if (text !== '' && send('append', { ok: true, text }) === false) {
|
|
3027
|
+
// The delta was dropped: resend the whole window so the pane cannot
|
|
3028
|
+
// stay frozen behind a permanent gap.
|
|
3029
|
+
await snapshot()
|
|
3030
|
+
return
|
|
3031
|
+
}
|
|
3024
3032
|
const service = await readService(target)
|
|
3025
3033
|
send('service', service === undefined ? { serviceKnown: true } : { service, serviceKnown: true })
|
|
3026
3034
|
} catch (error) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-ris-ide",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.10",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "RIS-IDE local dev panel for the DSH web GUI: live log tail, one-click start/stop of workspace programs, JDWP debugging, file tree + editor, and a standalone IDE window that carries no session history. · DSH 右侧栏本地开发面板:日志实时跟随、一键启停本地程序、Java 断点调试、文件树与编辑器、独立 IDE 窗口。",
|
|
6
6
|
"keywords": [
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
],
|
|
20
20
|
"repository": {
|
|
21
21
|
"type": "git",
|
|
22
|
-
"url": "https://
|
|
22
|
+
"url": "git+https://github.com/ris-cloud/dsh-ris-ide.git"
|
|
23
23
|
},
|
|
24
24
|
"homepage": "https://gitee.com/riscloud/dsh-ris-ide#readme",
|
|
25
25
|
"bugs": {
|
|
@@ -202,8 +202,9 @@ test('only invisible outcomes and failures raise a toast', async () => {
|
|
|
202
202
|
// so it keeps a short confirmation toast.
|
|
203
203
|
assert.ok(source.includes('文件树已刷新'), 'manual tree refresh confirms with a toast')
|
|
204
204
|
// The clipboard and the trash are not visible anywhere else: keep telling them.
|
|
205
|
+
// (The strip at the top of the tree is gone — the toast alone carries the state.)
|
|
205
206
|
assert.ok(source.includes("'已复制 ' : '已剪切 '"), 'clipboard state is invisible: keep it')
|
|
206
|
-
assert.
|
|
207
|
+
assert.equal(source.includes('data-tree-clipboard'), false, 'no clipboard strip above the tree')
|
|
207
208
|
assert.ok(source.includes('已移到回收站'))
|
|
208
209
|
})
|
|
209
210
|
|
|
@@ -862,6 +863,24 @@ test('the log viewer is read-only: no stop button, no redundant 到底部', { sk
|
|
|
862
863
|
assert.ok(!none.includes('data-action="stop"'))
|
|
863
864
|
})
|
|
864
865
|
|
|
866
|
+
// 1.6.10: the title-bar wrap toggle was a dead button — neither body style
|
|
867
|
+
// existed, so both modes fell back to the browser default and nothing moved.
|
|
868
|
+
test('the log wrap toggle really changes the body flow', { skip: !reactIsReal ? 'React unavailable for SSR' : false }, () => {
|
|
869
|
+
const { renderToStaticMarkup } = require(`${REACT_ROOT}/react-dom/server`)
|
|
870
|
+
const render = (wrap) => renderToStaticMarkup(React.createElement(T.LogTail, {
|
|
871
|
+
scope: { sessionId: 's1', cwd: '/tmp' },
|
|
872
|
+
path: 'service.log',
|
|
873
|
+
wrap,
|
|
874
|
+
customData: { ok: true, content: 'BOOT-OK\n', mode: 'tail', serviceKnown: true },
|
|
875
|
+
}))
|
|
876
|
+
const wrapped = render(true)
|
|
877
|
+
assert.match(wrapped, /data-wrap="on"/)
|
|
878
|
+
assert.match(wrapped, /white-space:pre-wrap/, 'wrap on breaks long lines at the pane edge')
|
|
879
|
+
const plain = render(false)
|
|
880
|
+
assert.match(plain, /data-wrap="off"/)
|
|
881
|
+
assert.match(plain, /white-space:pre/, 'wrap off keeps lines intact and scrolls horizontally')
|
|
882
|
+
})
|
|
883
|
+
|
|
865
884
|
test('requestStop posts the scope and reports the outcome', async () => {
|
|
866
885
|
await withLogServer(async ({ file, state }) => {
|
|
867
886
|
const ok = await T.requestStop(file, { sessionId: 's1', cwd: '/tmp' })
|
|
@@ -1245,7 +1264,8 @@ test('the selected range is highlighted stronger than the other matches', async
|
|
|
1245
1264
|
assert.match(source, /var SELECTION_CSS = /)
|
|
1246
1265
|
assert.match(source, /rgba\(86,182,194,0\.42\)/, 'selection is opaque teal')
|
|
1247
1266
|
// the active-line tint must not cover the selection on the current line(s)
|
|
1248
|
-
assert.match(source, /cm-selectionLayer\{z-index:5 !important\}
|
|
1267
|
+
assert.match(source, /cm-selectionLayer\{z-index:5 !important;pointer-events:none !important\}/,
|
|
1268
|
+
'the raised selection layer must not swallow clicks meant for the caret')
|
|
1249
1269
|
assert.match(source, /dsh-ris-ide-has-selection \.cm-activeLine/, 'selection hides the current-line tint')
|
|
1250
1270
|
assert.match(source, /dsh-ris-ide-has-selection \.cm-activeLineGutter/)
|
|
1251
1271
|
assert.match(source, /rgba\(86,182,194,0\.50\)/, 'focused selection is stronger')
|
|
@@ -1265,6 +1285,33 @@ test('the tree clipboard keys only fire while the tree owns the focus', async ()
|
|
|
1265
1285
|
assert.match(source, /tabIndex: -1/)
|
|
1266
1286
|
})
|
|
1267
1287
|
|
|
1288
|
+
// 1.6.10: Ctrl+C / Ctrl+X used to read the context-menu state only, so the
|
|
1289
|
+
// keyboard silently copied nothing; 全选 has no meaning in a single-selection
|
|
1290
|
+
// tree and must not hand the page a text selection either.
|
|
1291
|
+
test('Ctrl+C copies the selected tree row without the context menu', async () => {
|
|
1292
|
+
const { readFile } = await import('node:fs/promises')
|
|
1293
|
+
const source = await readFile(new URL('../lib/client.js', import.meta.url), 'utf8')
|
|
1294
|
+
assert.match(source, /var entry = treeMenu !== null && treeMenu\.entry !== null && treeMenu\.entry !== undefined/,
|
|
1295
|
+
'the context-menu entry still wins when the menu is open')
|
|
1296
|
+
assert.match(source, /: \(selectedPath === null \? null : findEntry\(selectedPath\)\)/,
|
|
1297
|
+
'the keyboard falls back to the tree selection')
|
|
1298
|
+
assert.match(source, /if \(entry === null \|\| entry === undefined\) return/)
|
|
1299
|
+
assert.match(source, /event\.key === 'a' \|\| event\.key === 'A'/, 'Ctrl+A is claimed while the tree owns the keys')
|
|
1300
|
+
})
|
|
1301
|
+
|
|
1302
|
+
test('a file row is a drop target for the directory it lives in', async () => {
|
|
1303
|
+
const { readFile } = await import('node:fs/promises')
|
|
1304
|
+
const source = await readFile(new URL('../lib/client.js', import.meta.url), 'utf8')
|
|
1305
|
+
assert.match(source, /var dropDir = entry\.isDir === true \? entry\.path : parentOf\(entry\.path\)/)
|
|
1306
|
+
assert.match(source, /var isDropTarget = dropTarget === entry\.path/, 'file rows highlight too')
|
|
1307
|
+
assert.match(source, /void moveInto\(from, dropDir\)/, 'dropping on a file moves into its parent')
|
|
1308
|
+
assert.match(source, /void importExternal\(dropDir, external, \[\]\)/)
|
|
1309
|
+
// The row handlers must not be dir-gated any more (the bug: `undefined` let the
|
|
1310
|
+
// list container's "blank area = workspace root" drop swallow the event).
|
|
1311
|
+
assert.doesNotMatch(source, /onDrop: entry\.isDir === true \?/)
|
|
1312
|
+
assert.doesNotMatch(source, /onDragOver: entry\.isDir === true \?/)
|
|
1313
|
+
})
|
|
1314
|
+
|
|
1268
1315
|
test('a forced tree read asks the host for a fresh listing', async () => {
|
|
1269
1316
|
const { readFile } = await import('node:fs/promises')
|
|
1270
1317
|
const source = await readFile(new URL('../lib/client.js', import.meta.url), 'utf8')
|
|
@@ -1289,14 +1336,39 @@ test('the tree 复制 menu copies, while 创建副本 makes the duplicate', asyn
|
|
|
1289
1336
|
assert.match(source, /setPrompt\(\{ mode: 'duplicate'/)
|
|
1290
1337
|
assert.match(source, /setPromptName\(duplicateName\(/)
|
|
1291
1338
|
assert.match(source, /副本名称不能与原文件相同/)
|
|
1292
|
-
// A paste collision
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
assert.match(source, /
|
|
1339
|
+
// A paste collision asks for a NEW name (the 副本 convention prefilled), it does
|
|
1340
|
+
// not park a 覆盖/改名/取消 dialog any more — and the copy banner at the top of
|
|
1341
|
+
// the tree is gone.
|
|
1342
|
+
assert.match(source, /function parkPasteName\(source, dir, name\)/)
|
|
1343
|
+
assert.match(source, /setPrompt\(\{ mode: 'paste', dir: dir, ext: '', title: '粘贴为', source: source, conflict: name \}\)/)
|
|
1344
|
+
assert.match(source, /setPromptName\(duplicateName\(name, false\)\)/)
|
|
1345
|
+
assert.match(source, /if \(prompt\.conflict !== undefined && name === prompt\.conflict\)/)
|
|
1346
|
+
assert.match(source, /if \(isExistsProblem\(problem\)\) \{\n\s+parkPasteName\(source, dir, name\)/)
|
|
1347
|
+
assert.doesNotMatch(source, /data-tree-paste-conflict/)
|
|
1348
|
+
assert.doesNotMatch(source, /data-tree-clipboard/)
|
|
1349
|
+
// A COPY onto its own path is a duplicate request (falls through to the prompt),
|
|
1350
|
+
// while CUT → its own folder stays a silent no-op.
|
|
1351
|
+
assert.match(source, /if \(source\.kind === 'clipboard' && target === from && clipboard\.mode !== 'copy'\)/)
|
|
1296
1352
|
// …and moving an entry into its own folder stays a silent no-op.
|
|
1297
1353
|
assert.match(source, /if \(from === dirPath \|\| parentOf\(from\) === dirPath\) return/)
|
|
1298
1354
|
})
|
|
1299
1355
|
|
|
1356
|
+
test('the recent-file dropdown is walkable like the result list', async () => {
|
|
1357
|
+
const { readFile } = await import('node:fs/promises')
|
|
1358
|
+
const source = await readFile(new URL('../lib/client.js', import.meta.url), 'utf8')
|
|
1359
|
+
// One highlighted index drives both dropdowns.
|
|
1360
|
+
assert.match(source, /var inHistory = searchHistoryRows\.length > 0/)
|
|
1361
|
+
assert.match(source, /var count = inHistory \? searchHistoryRows\.length : matches\.length/)
|
|
1362
|
+
// Landing on the box highlights row 0 of the history list.
|
|
1363
|
+
assert.match(source, /if \(searchHistoryRows\.length === 0\) return\n\s+setSearchActive\(0\)/)
|
|
1364
|
+
// …and the row can be opened with Enter without touching the caret.
|
|
1365
|
+
assert.match(source, /if \(inHistory\) \{\n\s+var row = searchHistoryRows\[index\]/)
|
|
1366
|
+
assert.match(source, /void openRecentPath\(row\.path\)/)
|
|
1367
|
+
assert.match(source, /'data-search-history-active': on \? '1' : '0'/)
|
|
1368
|
+
assert.match(source, /onMouseEnter: function \(\) \{ setSearchActive\(index\) \}/)
|
|
1369
|
+
assert.match(source, /最近打开 · ' \+ searchHistoryRows\.length \+ ' 个(↑↓ 选择,Enter 打开)/)
|
|
1370
|
+
})
|
|
1371
|
+
|
|
1300
1372
|
test('renaming a file or folder keeps tabs, drafts and history pointing at it', async () => {
|
|
1301
1373
|
// paths under a renamed folder follow it; unrelated paths stay untouched
|
|
1302
1374
|
assert.equal(T.remapPath('/w/a.java', '/w/a.java', '/w/b.java'), '/w/b.java')
|
|
@@ -1704,10 +1776,10 @@ test('only DSH\'s own chords are swallowed inside the IDE', () => {
|
|
|
1704
1776
|
assert.equal(T.shouldBlockHostChord(undefined, false), false)
|
|
1705
1777
|
})
|
|
1706
1778
|
|
|
1707
|
-
test('
|
|
1779
|
+
test('both reload forms are swallowed; Ctrl+Shift+R is the find chord too', () => {
|
|
1708
1780
|
assert.equal(T.isBrowserReloadChord({ ctrlKey: true, key: 'r' }), true)
|
|
1709
1781
|
assert.equal(T.isBrowserReloadChord({ metaKey: true, key: 'R' }), true)
|
|
1710
|
-
assert.equal(T.isBrowserReloadChord({ ctrlKey: true, shiftKey: true, key: '
|
|
1782
|
+
assert.equal(T.isBrowserReloadChord({ ctrlKey: true, shiftKey: true, key: 'R' }), true, 'the browser hard reload is suppressed as well')
|
|
1711
1783
|
assert.equal(T.isBrowserReloadChord({ ctrlKey: true, key: 'f5' }), false)
|
|
1712
1784
|
assert.equal(T.isBrowserReloadChord({ key: 'F5' }), false)
|
|
1713
1785
|
assert.equal(T.isBrowserReloadChord({ ctrlKey: true, altKey: true, key: 'r' }), false)
|
|
@@ -1727,14 +1799,15 @@ test('the shielded set is exactly DSH\'s catalog', () => {
|
|
|
1727
1799
|
assert.equal(T.chordOf({ key: 'F5' }), '', 'no modifier: not a chord')
|
|
1728
1800
|
})
|
|
1729
1801
|
|
|
1730
|
-
test('Ctrl+R focuses the workspace search (and
|
|
1802
|
+
test('Ctrl+R focuses the workspace search (and both browser reloads are suppressed)', () => {
|
|
1731
1803
|
assert.equal(T.GLOBAL_FIND_KEY, 'r')
|
|
1732
1804
|
assert.equal(T.GLOBAL_FIND_LABEL, 'Ctrl+R / F3')
|
|
1733
1805
|
assert.equal(T.isGlobalFindChord({ ctrlKey: true, key: 'r' }), true)
|
|
1734
1806
|
assert.equal(T.isGlobalFindChord({ metaKey: true, key: 'R' }), true)
|
|
1735
1807
|
assert.equal(T.isGlobalFindChord({ key: 'F3' }), true)
|
|
1736
|
-
// Ctrl+Shift+R (
|
|
1737
|
-
|
|
1808
|
+
// Ctrl+Shift+R (the browser's HARD reload) is the same chord: it must land in the
|
|
1809
|
+
// search box instead of throwing the whole IDE away.
|
|
1810
|
+
assert.equal(T.isGlobalFindChord({ ctrlKey: true, shiftKey: true, key: 'R' }), true)
|
|
1738
1811
|
assert.equal(T.isGlobalFindChord({ ctrlKey: true, altKey: true, key: 'f' }), false, 'Ctrl+Alt+F is DSH fork')
|
|
1739
1812
|
assert.equal(T.isGlobalFindChord({ ctrlKey: true, key: 'f' }), false, 'Ctrl+F belongs to editors')
|
|
1740
1813
|
assert.equal(T.isGlobalFindChord(undefined), false)
|
|
@@ -1912,7 +1985,7 @@ test('Ctrl+R turns a single-line editor selection into the search query', async
|
|
|
1912
1985
|
assert.match(source, /if \(text === '' \|\| text\.indexOf\('\\n'\) !== -1 \|\| text\.length > GLOBAL_FIND_SELECTION_MAX\) return ''/, 'multiline / oversized selections are ignored')
|
|
1913
1986
|
assert.match(source, /if \(element\.closest\('\.cm-content'\) === null\) return ''/, 'only editor selections count')
|
|
1914
1987
|
assert.match(source, /var picked = selectedEditorText\(\)[\s\S]{0,400}?setTreeQuery\(picked\)/, 'the pick becomes the query')
|
|
1915
|
-
assert.match(source, /h\(SearchResults, \{
|
|
1988
|
+
assert.match(source, /h\(SearchResults, \{[\s\S]{0,240}?active: searchActive, onHover: setSearchActive,[\s\S]{0,120}?fontRatio: fontRatio, cwd: cwd,/, 'results know the workspace root and the highlighted row')
|
|
1916
1989
|
})
|
|
1917
1990
|
|
|
1918
1991
|
test('an unfocused editor stops painting its selection', async () => {
|
|
@@ -2275,6 +2348,47 @@ test('the search dropdown renders hits, empty state and errors', { skip: !reactI
|
|
|
2275
2348
|
assert.match(render({ error: 'boom' }), /检索失败:boom/)
|
|
2276
2349
|
})
|
|
2277
2350
|
|
|
2351
|
+
test('the dropdown highlights the exact file-name match, else the first row', () => {
|
|
2352
|
+
const hits = { matches: ['/w/x/Alpha.java', '/w/y/ModelHelper.java'], dirs: {} }
|
|
2353
|
+
assert.equal(T.searchHitActiveIndex(hits, 'ModelHelper.java'), 1, 'the full name the user typed wins over row 0')
|
|
2354
|
+
assert.equal(T.searchHitActiveIndex(hits, 'modelhelper.JAVA'), 1, 'case does not matter')
|
|
2355
|
+
assert.equal(T.searchHitActiveIndex(hits, 'Missing.java'), 0, 'no exact name: the first row')
|
|
2356
|
+
assert.equal(T.searchHitActiveIndex(hits, ''), 0)
|
|
2357
|
+
// A directory whose basename matches is never the "file name" target.
|
|
2358
|
+
assert.equal(T.searchHitActiveIndex({ matches: ['/w/src', '/w/z/src'], dirs: { '/w/src': true } }, 'src'), 1, 'a directory is skipped when matching a name')
|
|
2359
|
+
assert.equal(T.searchHitActiveIndex({ matches: [], dirs: {} }, 'a'), -1)
|
|
2360
|
+
assert.equal(T.searchHitActiveIndex(null, 'a'), -1)
|
|
2361
|
+
assert.equal(T.searchHitActiveIndex(undefined, undefined), -1)
|
|
2362
|
+
})
|
|
2363
|
+
|
|
2364
|
+
test('the highlighted search row is marked, tinted and hover-driven', { skip: !reactIsReal ? 'React unavailable for SSR' : false }, () => {
|
|
2365
|
+
const { renderToStaticMarkup } = require(`${REACT_ROOT}/react-dom/server`)
|
|
2366
|
+
const markup = renderToStaticMarkup(React.createElement(T.SearchResults, {
|
|
2367
|
+
hits: { matches: ['/w/a.java', '/w/b.java'], dirs: {} },
|
|
2368
|
+
active: 1,
|
|
2369
|
+
fontRatio: 1,
|
|
2370
|
+
onPick: () => {},
|
|
2371
|
+
onHover: () => {},
|
|
2372
|
+
}))
|
|
2373
|
+
assert.match(markup, /data-search-hit-path="\/w\/a\.java"[^>]*data-search-hit-active="0"/)
|
|
2374
|
+
assert.match(markup, /data-search-hit-path="\/w\/b\.java"[^>]*data-search-hit-active="1"/)
|
|
2375
|
+
assert.match(markup, /style="[^"]*background:color-mix\(in srgb, currentColor 18%, transparent\)"[^>]*data-search-hit-active="1"/, 'the active row is tinted')
|
|
2376
|
+
})
|
|
2377
|
+
|
|
2378
|
+
test('the workspace search keeps its caret while the dropdown is walked', async () => {
|
|
2379
|
+
const source = await readFile(new URL('../lib/client.js', import.meta.url), 'utf8')
|
|
2380
|
+
// Arrows move the ROW, and preventDefault keeps the caret where it was.
|
|
2381
|
+
assert.match(source, /if \(event\.key === 'ArrowDown' \|\| event\.key === 'ArrowUp'\) \{[\s\S]{0,600}?event\.preventDefault\(\)[\s\S]{0,200}?setSearchActive\(function \(current\)/, 'arrows walk the results')
|
|
2382
|
+
assert.match(source, /\(from \+ step \+ count\) % count/, 'the walk wraps around')
|
|
2383
|
+
assert.match(source, /if \(event\.key !== 'Enter'\) return[\s\S]{0,1200}?pickSearchHit\(chosen,/, 'Enter picks the highlighted row')
|
|
2384
|
+
assert.match(source, /if \(inHistory\) \{\n\s+var row = searchHistoryRows\[index\][\s\S]{0,300}?void openRecentPath\(row\.path\)/, 'Enter opens the highlighted recent file')
|
|
2385
|
+
// A click on a row must not blur the box.
|
|
2386
|
+
assert.match(source, /'data-search-results': '1',[\s\S]{0,400}?onMouseDown: function \(event\) \{ event\.preventDefault\(\) \}/, 'the dropdown swallows mousedown')
|
|
2387
|
+
// The payload arrives with a highlight already computed.
|
|
2388
|
+
assert.match(source, /setSearchActive\(searchHitActiveIndex\(searchHits, treeQuery\)\)/)
|
|
2389
|
+
assert.match(source, /function searchHitActiveIndex\(hits, query\)/)
|
|
2390
|
+
})
|
|
2391
|
+
|
|
2278
2392
|
test('the log pane title bar holds icon buttons (no refresh, no find button)', { skip: !reactIsReal ? 'React unavailable for SSR' : false }, () => {
|
|
2279
2393
|
const tab = { id: T.PROGRAM_TAB_ID, type: T.PROGRAM_TAB_ID, title: 'workspace', meta: { logPath: '/w/logs/a.log', name: 'a-biz', kind: 'spring' } }
|
|
2280
2394
|
const programs = [{ id: 'spring:a#A', name: 'a-biz', kind: 'spring', logPath: '/w/logs/a.log', hasLog: true, running: { pid: 42, alive: true } }]
|
|
@@ -3254,7 +3368,7 @@ test('a start switches to that program log before waiting for the spawn', async
|
|
|
3254
3368
|
// block for START_WAIT_MS, and Maven compile prints nothing for tens of seconds.
|
|
3255
3369
|
assert.match(source, /async function consoleStart\(program\) \{\n\s*\/\/[\s\S]*?\n\s*selectProgram\(program\)[\s\S]*?setConsoleBusy\(program\.id\)[\s\S]*?requestStart\(program\.id, scopeRef\.current\)/)
|
|
3256
3370
|
// The sidebar rows do the same before awaiting requestStart.
|
|
3257
|
-
assert.match(source, /if \(kind === 'start'\) \{ setActive\(program\); broadcastLogFocus\(program\.logPath\)
|
|
3371
|
+
assert.match(source, /if \(kind === 'start'\) \{ setActive\(program\); broadcastLogFocus\(program\.logPath\); setCompactLogNonce/)
|
|
3258
3372
|
// …and every window watching another log is moved by the same broadcast.
|
|
3259
3373
|
assert.match(source, /function broadcastLogFocus\(logPath\)/)
|
|
3260
3374
|
})
|
|
@@ -3555,3 +3669,28 @@ test('trimLargeTextFront frees whole lines and keeps the line count aligned', ()
|
|
|
3555
3669
|
assert.deepEqual(T.trimLargeTextFront('short', 100), { text: 'short', droppedLines: 0, droppedChars: 0 })
|
|
3556
3670
|
assert.deepEqual(T.trimLargeTextFront('', 100), { text: '', droppedLines: 0, droppedChars: 0 })
|
|
3557
3671
|
})
|
|
3672
|
+
|
|
3673
|
+
test('the editor scrollbars are visible and a start re-reads its log', async () => {
|
|
3674
|
+
const source = await readFile(new URL('../lib/client.js', import.meta.url), 'utf8')
|
|
3675
|
+
// BUG3: the host theme paints a 5px near-invisible scrollbar; the panel gives
|
|
3676
|
+
// the editor/log/tree real bars without reserving a gutter on short files.
|
|
3677
|
+
assert.match(source, /var SCROLLBAR_CSS = /)
|
|
3678
|
+
assert.match(source, /::-webkit-scrollbar\{width:10px;height:10px\}/)
|
|
3679
|
+
assert.match(source, /::-webkit-scrollbar-thumb/)
|
|
3680
|
+
assert.match(source, /SELECTION_CSS \+ SCROLLBAR_CSS \+ TOAST_CSS/, 'injected with the panel styles')
|
|
3681
|
+
assert.doesNotMatch(source, /SCROLLBAR_CSS[\s\S]{0,800}?scrollbar-gutter/, 'no empty gutter on files that do not overflow')
|
|
3682
|
+
// BUG6: a start records a size baseline and watches for its first new byte …
|
|
3683
|
+
assert.match(source, /async function consoleStart\(program\) \{[\s\S]{0,700}?await logSizeOf\(logPath\)/, 'the start records a size baseline')
|
|
3684
|
+
assert.match(source, /async function consoleStart\(program\) \{[\s\S]{0,2400}?watchLogOutput\(logPath, baseline\)/, 'and watches the first new byte')
|
|
3685
|
+
// … a pane mounting on an already-open socket reads its tail once …
|
|
3686
|
+
assert.match(source, /if \(typeof EventSource !== 'function'\) return\n\s*void refresh\(\)/, 'first paint reads the tail')
|
|
3687
|
+
// … and the shared socket reports which file it follows, so a second log pane
|
|
3688
|
+
// polls instead of waiting on someone else's stream.
|
|
3689
|
+
assert.match(source, /var servedTail = ''/, 'the connection remembers its tail path')
|
|
3690
|
+
assert.match(source, /notifyOpen\(\)/)
|
|
3691
|
+
assert.match(source, /setStreamOk\(served === '' \|\| served === path\)/, 'a pane the socket does not carry falls back to polling')
|
|
3692
|
+
assert.match(source, /setCompactLogNonce\(function \(value\) \{ return value \+ 1 \}\)/, 'the sidebar pane re-reads after start/stop')
|
|
3693
|
+
// … and the host never drops a delta without re-snapshotting.
|
|
3694
|
+
const host = await readFile(new URL('../lib/index.js', import.meta.url), 'utf8')
|
|
3695
|
+
assert.match(host, /if \(text !== '' && send\('append', \{ ok: true, text \}\) === false\) \{[\s\S]{0,200}?await snapshot\(\)/, 'a dropped frame re-snapshots')
|
|
3696
|
+
})
|