dsh-gufa-code 1.3.209 → 1.3.210
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 +10 -0
- package/client.js +99 -1
- package/package.json +1 -1
- package/src/client/85-shortcuts.js +98 -0
package/README.md
CHANGED
|
@@ -115,6 +115,16 @@ dsh plugin add dsh-gufa-code
|
|
|
115
115
|
- 颜色全部走 DSH 主题 token,亮/暗主题自动跟随;界面宽度、开关状态持久化到 localStorage;
|
|
116
116
|
- 与皮肤插件兼容:如果装有「滑动变祖」这类皮肤,IDE 面板会半透明透出皮肤人像/粒子,编辑器区域也保持轻微透明。
|
|
117
117
|
|
|
118
|
+
## 更新日志
|
|
119
|
+
|
|
120
|
+
### 1.3.210(最新)
|
|
121
|
+
|
|
122
|
+
- **Git 面板支持多个仓库**:自动列出工作区根目录和一级子目录里的全部 Git 仓库,可逐个查看状态、暂存、提交、推送、拉取、切换分支、查看 diff / Git Graph;子目录仓库摘要每 5 秒自动刷新。
|
|
123
|
+
- **Git 还原逻辑修正**:未跟踪的新文件不再报 `pathspec ... did not match`,改为删除文件并二次确认;未跟踪状态显示为 `U`;「撤销所有改动」会连同未跟踪新文件一起删除(保留 `.gitignore` 忽略的文件)。
|
|
124
|
+
- **资源管理器支持系统剪贴板粘贴**:在 Finder / 资源管理器里复制的文件或文件夹,可直接 `Cmd/Ctrl+V` 或右键「粘贴」进当前目录;支持多选、文件夹、同名自动生成「副本」(macOS / Windows / Linux)。
|
|
125
|
+
- **切换会话弹窗显示会话状态**:与经典侧边栏一致——运行中显示 spinner,待审批 / 计划待审 / 待回答显示黄色状态点和紧凑文案,已完成显示绿点,空闲留空。
|
|
126
|
+
- **修复 Cmd+K 清空终端失效**:命令改派支持懒注册命令、按当前快捷键目录动态识别实际绑定「主修饰键+K」的命令,并在 dispatch 层兜底;DSH 快捷键冲突或命令 id 变化时 IDE 内仍能接管为「清空终端」。
|
|
127
|
+
|
|
118
128
|
## 发布(维护者)
|
|
119
129
|
|
|
120
130
|
打 tag + 建 GitHub Release 即可自动发布:`publish.yml` 用 npm trusted publishing(OIDC)发 npm 包,`build-float.yml` 编译三平台 helper 并挂到 Release assets。详见 [`docs/RELEASE.md`](docs/RELEASE.md)。
|
package/client.js
CHANGED
|
@@ -16,7 +16,7 @@ const GUFA_NS = 'gufa-code'
|
|
|
16
16
|
const G = {}
|
|
17
17
|
G.NS = GUFA_NS
|
|
18
18
|
/** 客户端构建标记(排查页面是否加载了新代码时看标题栏) */
|
|
19
|
-
G.BUILD = '1.3.
|
|
19
|
+
G.BUILD = '1.3.210'
|
|
20
20
|
G.PANEL_ID = 'gufa-code'
|
|
21
21
|
/** 从哪个工作区点进来的(工作区菜单/节点按钮写入,App 启动时消费)。 */
|
|
22
22
|
G.pendingEntryWorkspace = null
|
|
@@ -12517,6 +12517,12 @@ G.installShortcutIntegration = function installShortcutIntegration(service) {
|
|
|
12517
12517
|
|
|
12518
12518
|
// 经典模式:不碰任何 DSH 原生命令
|
|
12519
12519
|
if (G.mode.get() !== true) {
|
|
12520
|
+
/* IDE 模式退出时把 dispatch 补丁还原,经典模式继续走 DSH 原生派发 */
|
|
12521
|
+
if (registry.__gufaDispatchPatched === true && typeof registry.__gufaOriginalDispatch === 'function') {
|
|
12522
|
+
registry.dispatch = registry.__gufaOriginalDispatch
|
|
12523
|
+
delete registry.__gufaOriginalDispatch
|
|
12524
|
+
delete registry.__gufaDispatchPatched
|
|
12525
|
+
}
|
|
12520
12526
|
try {
|
|
12521
12527
|
if (window !== undefined && window !== null) {
|
|
12522
12528
|
if (window.__gufaClassicShortcutLogs === undefined) window.__gufaClassicShortcutLogs = 3
|
|
@@ -12556,6 +12562,22 @@ G.installShortcutIntegration = function installShortcutIntegration(service) {
|
|
|
12556
12562
|
'edrv.prevTab': 'prevTab',
|
|
12557
12563
|
'edrv.nextTab': 'nextTab',
|
|
12558
12564
|
}
|
|
12565
|
+
/* DSH 升级/用户自定义可能把 Cmd+K 改绑到别的命令 id:以当前快捷键目录为准,
|
|
12566
|
+
把实际占用「主修饰键+K」的命令也改派成 clearTerminal(默认仍是 session.search)。 */
|
|
12567
|
+
try {
|
|
12568
|
+
const rows = registry.catalog !== null && registry.catalog !== undefined && typeof registry.catalog.getSnapshot === 'function'
|
|
12569
|
+
? registry.catalog.getSnapshot()
|
|
12570
|
+
: []
|
|
12571
|
+
const wanted = G.isMacPlatform() ? '⌘K' : 'Ctrl+K'
|
|
12572
|
+
for (const row of Array.isArray(rows) ? rows : []) {
|
|
12573
|
+
const keys = Array.isArray(row?.keys) ? row.keys : []
|
|
12574
|
+
if (keys.join('') !== wanted) continue
|
|
12575
|
+
if (typeof row?.id !== 'string' || row.id === '') continue
|
|
12576
|
+
if (typeof commandActions[row.id] !== 'string') commandActions[row.id] = 'clearTerminal'
|
|
12577
|
+
}
|
|
12578
|
+
} catch {
|
|
12579
|
+
/* ignore */
|
|
12580
|
+
}
|
|
12559
12581
|
service.__gufaCommandActions = commandActions
|
|
12560
12582
|
const wrapped = []
|
|
12561
12583
|
const commands = registry.commands
|
|
@@ -12572,6 +12594,10 @@ G.installShortcutIntegration = function installShortcutIntegration(service) {
|
|
|
12572
12594
|
status: 'handled',
|
|
12573
12595
|
run: () => {
|
|
12574
12596
|
try {
|
|
12597
|
+
if ((window.__gufaCommandRemapLogs ?? 0) < 20) {
|
|
12598
|
+
window.__gufaCommandRemapLogs = (window.__gufaCommandRemapLogs ?? 0) + 1
|
|
12599
|
+
void G.api('dev.log', { message: `command-remap ${id} -> ${mapped}` }).catch(() => {})
|
|
12600
|
+
}
|
|
12575
12601
|
if (mapped.startsWith('editor:')) {
|
|
12576
12602
|
if (G.bus !== null && G.bus !== undefined) G.bus.emit('editor:command', mapped.slice('editor:'.length))
|
|
12577
12603
|
return
|
|
@@ -12612,7 +12638,79 @@ G.installShortcutIntegration = function installShortcutIntegration(service) {
|
|
|
12612
12638
|
service.__gufaPatchedCommands.push({ command, originalResolve })
|
|
12613
12639
|
wrapped.push(id)
|
|
12614
12640
|
}
|
|
12641
|
+
/* 懒加载的命令(例如 workspace 的 session.search 可能晚于插件初始化才注册):
|
|
12642
|
+
包一次 commands.set,注册时立即补上 resolve 改派,避免 Cmd+K 又退回原生搜索。 */
|
|
12643
|
+
try {
|
|
12644
|
+
if (typeof commands.set === 'function' && commands.__gufaSetPatched !== true) {
|
|
12645
|
+
const originalSet = commands.set
|
|
12646
|
+
commands.set = function gufaShortcutCommandsSet(id, command) {
|
|
12647
|
+
const result = originalSet.call(this, id, command)
|
|
12648
|
+
try {
|
|
12649
|
+
const mapped = service.__gufaCommandActions === null || service.__gufaCommandActions === undefined
|
|
12650
|
+
? undefined
|
|
12651
|
+
: service.__gufaCommandActions[id]
|
|
12652
|
+
if (typeof mapped === 'string' && command !== null && command !== undefined
|
|
12653
|
+
&& typeof command.resolve === 'function' && command.__gufaWrapped !== true) {
|
|
12654
|
+
const originalResolve = command.resolve
|
|
12655
|
+
try {
|
|
12656
|
+
Object.defineProperty(command, '__gufaOriginalResolve', { value: originalResolve, configurable: true })
|
|
12657
|
+
} catch {
|
|
12658
|
+
/* ignore */
|
|
12659
|
+
}
|
|
12660
|
+
command.resolve = makeResolve(id, originalResolve)
|
|
12661
|
+
try {
|
|
12662
|
+
Object.defineProperty(command, '__gufaWrapped', { value: true, configurable: true })
|
|
12663
|
+
} catch {
|
|
12664
|
+
/* ignore */
|
|
12665
|
+
}
|
|
12666
|
+
if (Array.isArray(service.__gufaPatchedCommands) !== true) service.__gufaPatchedCommands = []
|
|
12667
|
+
service.__gufaPatchedCommands.push({ command, originalResolve })
|
|
12668
|
+
}
|
|
12669
|
+
} catch {
|
|
12670
|
+
/* ignore */
|
|
12671
|
+
}
|
|
12672
|
+
return result
|
|
12673
|
+
}
|
|
12674
|
+
commands.__gufaSetPatched = true
|
|
12675
|
+
}
|
|
12676
|
+
} catch {
|
|
12677
|
+
/* ignore */
|
|
12678
|
+
}
|
|
12615
12679
|
}
|
|
12680
|
+
/* 兜底:如果 Cmd+K 在 DSH 里存在快捷键冲突,dispatch 会在调用 command.resolve 之前就
|
|
12681
|
+
把按键 consume 掉(表现为快捷键完全没反应)。IDE 模式下直接在 dispatch 最前面接管
|
|
12682
|
+
主修饰键+K → 清空终端,不依赖具体 command id 是否被包到。 */
|
|
12683
|
+
try {
|
|
12684
|
+
if (typeof registry.dispatch === 'function' && registry.__gufaDispatchPatched !== true) {
|
|
12685
|
+
const originalDispatch = registry.dispatch
|
|
12686
|
+
registry.dispatch = function gufaIdeDispatch(gesture, context, consume) {
|
|
12687
|
+
try {
|
|
12688
|
+
if (G.mode.get() === true
|
|
12689
|
+
&& typeof document !== 'undefined'
|
|
12690
|
+
&& document.querySelector('.gufa-overlay-root') !== null
|
|
12691
|
+
&& typeof window.__gufaIdeShortcutDispatch === 'function') {
|
|
12692
|
+
const mac = G.isMacPlatform()
|
|
12693
|
+
const primary = mac ? gesture?.meta === true && gesture?.control !== true : gesture?.control === true
|
|
12694
|
+
if (primary && gesture?.code === 'KeyK' && gesture?.shift !== true && gesture?.alt !== true) {
|
|
12695
|
+
if (typeof consume === 'function') consume()
|
|
12696
|
+
if (gesture?.repeat !== true) {
|
|
12697
|
+
try { window.__gufaIdeShortcutDispatch('clearTerminal') } catch { /* ignore */ }
|
|
12698
|
+
}
|
|
12699
|
+
return { status: 'handled', commandId: 'gufa.ide.clearTerminal' }
|
|
12700
|
+
}
|
|
12701
|
+
}
|
|
12702
|
+
} catch {
|
|
12703
|
+
/* ignore */
|
|
12704
|
+
}
|
|
12705
|
+
return originalDispatch.call(this, gesture, context, consume)
|
|
12706
|
+
}
|
|
12707
|
+
registry.__gufaOriginalDispatch = originalDispatch
|
|
12708
|
+
registry.__gufaDispatchPatched = true
|
|
12709
|
+
}
|
|
12710
|
+
} catch {
|
|
12711
|
+
/* ignore */
|
|
12712
|
+
}
|
|
12713
|
+
|
|
12616
12714
|
// ── 命令表/配置尚未就绪时重试(插件加载可能早于 ui-layout 注册命令)──
|
|
12617
12715
|
const expected = Object.keys(commandActions).length
|
|
12618
12716
|
try {
|
package/package.json
CHANGED
|
@@ -257,6 +257,12 @@ G.installShortcutIntegration = function installShortcutIntegration(service) {
|
|
|
257
257
|
|
|
258
258
|
// 经典模式:不碰任何 DSH 原生命令
|
|
259
259
|
if (G.mode.get() !== true) {
|
|
260
|
+
/* IDE 模式退出时把 dispatch 补丁还原,经典模式继续走 DSH 原生派发 */
|
|
261
|
+
if (registry.__gufaDispatchPatched === true && typeof registry.__gufaOriginalDispatch === 'function') {
|
|
262
|
+
registry.dispatch = registry.__gufaOriginalDispatch
|
|
263
|
+
delete registry.__gufaOriginalDispatch
|
|
264
|
+
delete registry.__gufaDispatchPatched
|
|
265
|
+
}
|
|
260
266
|
try {
|
|
261
267
|
if (window !== undefined && window !== null) {
|
|
262
268
|
if (window.__gufaClassicShortcutLogs === undefined) window.__gufaClassicShortcutLogs = 3
|
|
@@ -296,6 +302,22 @@ G.installShortcutIntegration = function installShortcutIntegration(service) {
|
|
|
296
302
|
'edrv.prevTab': 'prevTab',
|
|
297
303
|
'edrv.nextTab': 'nextTab',
|
|
298
304
|
}
|
|
305
|
+
/* DSH 升级/用户自定义可能把 Cmd+K 改绑到别的命令 id:以当前快捷键目录为准,
|
|
306
|
+
把实际占用「主修饰键+K」的命令也改派成 clearTerminal(默认仍是 session.search)。 */
|
|
307
|
+
try {
|
|
308
|
+
const rows = registry.catalog !== null && registry.catalog !== undefined && typeof registry.catalog.getSnapshot === 'function'
|
|
309
|
+
? registry.catalog.getSnapshot()
|
|
310
|
+
: []
|
|
311
|
+
const wanted = G.isMacPlatform() ? '⌘K' : 'Ctrl+K'
|
|
312
|
+
for (const row of Array.isArray(rows) ? rows : []) {
|
|
313
|
+
const keys = Array.isArray(row?.keys) ? row.keys : []
|
|
314
|
+
if (keys.join('') !== wanted) continue
|
|
315
|
+
if (typeof row?.id !== 'string' || row.id === '') continue
|
|
316
|
+
if (typeof commandActions[row.id] !== 'string') commandActions[row.id] = 'clearTerminal'
|
|
317
|
+
}
|
|
318
|
+
} catch {
|
|
319
|
+
/* ignore */
|
|
320
|
+
}
|
|
299
321
|
service.__gufaCommandActions = commandActions
|
|
300
322
|
const wrapped = []
|
|
301
323
|
const commands = registry.commands
|
|
@@ -312,6 +334,10 @@ G.installShortcutIntegration = function installShortcutIntegration(service) {
|
|
|
312
334
|
status: 'handled',
|
|
313
335
|
run: () => {
|
|
314
336
|
try {
|
|
337
|
+
if ((window.__gufaCommandRemapLogs ?? 0) < 20) {
|
|
338
|
+
window.__gufaCommandRemapLogs = (window.__gufaCommandRemapLogs ?? 0) + 1
|
|
339
|
+
void G.api('dev.log', { message: `command-remap ${id} -> ${mapped}` }).catch(() => {})
|
|
340
|
+
}
|
|
315
341
|
if (mapped.startsWith('editor:')) {
|
|
316
342
|
if (G.bus !== null && G.bus !== undefined) G.bus.emit('editor:command', mapped.slice('editor:'.length))
|
|
317
343
|
return
|
|
@@ -352,7 +378,79 @@ G.installShortcutIntegration = function installShortcutIntegration(service) {
|
|
|
352
378
|
service.__gufaPatchedCommands.push({ command, originalResolve })
|
|
353
379
|
wrapped.push(id)
|
|
354
380
|
}
|
|
381
|
+
/* 懒加载的命令(例如 workspace 的 session.search 可能晚于插件初始化才注册):
|
|
382
|
+
包一次 commands.set,注册时立即补上 resolve 改派,避免 Cmd+K 又退回原生搜索。 */
|
|
383
|
+
try {
|
|
384
|
+
if (typeof commands.set === 'function' && commands.__gufaSetPatched !== true) {
|
|
385
|
+
const originalSet = commands.set
|
|
386
|
+
commands.set = function gufaShortcutCommandsSet(id, command) {
|
|
387
|
+
const result = originalSet.call(this, id, command)
|
|
388
|
+
try {
|
|
389
|
+
const mapped = service.__gufaCommandActions === null || service.__gufaCommandActions === undefined
|
|
390
|
+
? undefined
|
|
391
|
+
: service.__gufaCommandActions[id]
|
|
392
|
+
if (typeof mapped === 'string' && command !== null && command !== undefined
|
|
393
|
+
&& typeof command.resolve === 'function' && command.__gufaWrapped !== true) {
|
|
394
|
+
const originalResolve = command.resolve
|
|
395
|
+
try {
|
|
396
|
+
Object.defineProperty(command, '__gufaOriginalResolve', { value: originalResolve, configurable: true })
|
|
397
|
+
} catch {
|
|
398
|
+
/* ignore */
|
|
399
|
+
}
|
|
400
|
+
command.resolve = makeResolve(id, originalResolve)
|
|
401
|
+
try {
|
|
402
|
+
Object.defineProperty(command, '__gufaWrapped', { value: true, configurable: true })
|
|
403
|
+
} catch {
|
|
404
|
+
/* ignore */
|
|
405
|
+
}
|
|
406
|
+
if (Array.isArray(service.__gufaPatchedCommands) !== true) service.__gufaPatchedCommands = []
|
|
407
|
+
service.__gufaPatchedCommands.push({ command, originalResolve })
|
|
408
|
+
}
|
|
409
|
+
} catch {
|
|
410
|
+
/* ignore */
|
|
411
|
+
}
|
|
412
|
+
return result
|
|
413
|
+
}
|
|
414
|
+
commands.__gufaSetPatched = true
|
|
415
|
+
}
|
|
416
|
+
} catch {
|
|
417
|
+
/* ignore */
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
/* 兜底:如果 Cmd+K 在 DSH 里存在快捷键冲突,dispatch 会在调用 command.resolve 之前就
|
|
421
|
+
把按键 consume 掉(表现为快捷键完全没反应)。IDE 模式下直接在 dispatch 最前面接管
|
|
422
|
+
主修饰键+K → 清空终端,不依赖具体 command id 是否被包到。 */
|
|
423
|
+
try {
|
|
424
|
+
if (typeof registry.dispatch === 'function' && registry.__gufaDispatchPatched !== true) {
|
|
425
|
+
const originalDispatch = registry.dispatch
|
|
426
|
+
registry.dispatch = function gufaIdeDispatch(gesture, context, consume) {
|
|
427
|
+
try {
|
|
428
|
+
if (G.mode.get() === true
|
|
429
|
+
&& typeof document !== 'undefined'
|
|
430
|
+
&& document.querySelector('.gufa-overlay-root') !== null
|
|
431
|
+
&& typeof window.__gufaIdeShortcutDispatch === 'function') {
|
|
432
|
+
const mac = G.isMacPlatform()
|
|
433
|
+
const primary = mac ? gesture?.meta === true && gesture?.control !== true : gesture?.control === true
|
|
434
|
+
if (primary && gesture?.code === 'KeyK' && gesture?.shift !== true && gesture?.alt !== true) {
|
|
435
|
+
if (typeof consume === 'function') consume()
|
|
436
|
+
if (gesture?.repeat !== true) {
|
|
437
|
+
try { window.__gufaIdeShortcutDispatch('clearTerminal') } catch { /* ignore */ }
|
|
438
|
+
}
|
|
439
|
+
return { status: 'handled', commandId: 'gufa.ide.clearTerminal' }
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
} catch {
|
|
443
|
+
/* ignore */
|
|
444
|
+
}
|
|
445
|
+
return originalDispatch.call(this, gesture, context, consume)
|
|
446
|
+
}
|
|
447
|
+
registry.__gufaOriginalDispatch = originalDispatch
|
|
448
|
+
registry.__gufaDispatchPatched = true
|
|
449
|
+
}
|
|
450
|
+
} catch {
|
|
451
|
+
/* ignore */
|
|
355
452
|
}
|
|
453
|
+
|
|
356
454
|
// ── 命令表/配置尚未就绪时重试(插件加载可能早于 ui-layout 注册命令)──
|
|
357
455
|
const expected = Object.keys(commandActions).length
|
|
358
456
|
try {
|