dsh-gufa-code 1.3.193 → 1.3.194

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/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.193'
19
+ G.BUILD = '1.3.194'
20
20
  G.PANEL_ID = 'gufa-code'
21
21
  /** 从哪个工作区点进来的(工作区菜单/节点按钮写入,App 启动时消费)。 */
22
22
  G.pendingEntryWorkspace = null
@@ -3371,14 +3371,13 @@ const GUFA_LINT_ENABLED = true
3371
3371
  /** 显式绑定 Cmd/Ctrl+Shift+L = 选中当前词在文件里的所有匹配项(VS Code/Cursor 习惯)。 */
3372
3372
  function gufaBindSelectAllOccurrences(monacoInstance, editor) {
3373
3373
  try {
3374
- editor.addAction({
3375
- id: 'gufa.selectAllOccurrences',
3376
- label: '选中所有匹配项',
3377
- keybindings: [monacoInstance.KeyMod.CtrlCmd | monacoInstance.KeyMod.Shift | monacoInstance.KeyCode.KeyL],
3378
- run: (target) => {
3379
- try { target.trigger('gufa-select-occurrences', 'editor.action.selectHighlights', null) } catch { /* ignore */ }
3374
+ /* addCommand 是底层键位绑定,比 addAction 更可靠(addAction 可能被同名内置 action 覆盖)。 */
3375
+ editor.addCommand(
3376
+ monacoInstance.KeyMod.CtrlCmd | monacoInstance.KeyMod.Shift | monacoInstance.KeyCode.KeyL,
3377
+ () => {
3378
+ try { editor.trigger('gufa-select-occurrences', 'editor.action.selectHighlights', null) } catch { /* ignore */ }
3380
3379
  },
3381
- })
3380
+ )
3382
3381
  } catch {
3383
3382
  /* ignore */
3384
3383
  }
@@ -4681,6 +4680,12 @@ const GUFA_LINT_ENABLED = true
4681
4680
  }
4682
4681
  const editor = editorRef.current
4683
4682
  const monaco = monacoRef.current
4683
+ if ((editor === null || editor === undefined) && diffEditorRef.current !== null && diffEditorRef.current !== undefined) {
4684
+ try {
4685
+ diffEditorRef.current.getModifiedEditor().trigger('gufa-shortcut', commandId, null)
4686
+ return
4687
+ } catch { /* ignore */ }
4688
+ }
4684
4689
  if (editor !== null && monaco !== null) {
4685
4690
  editor.trigger('gufa-shortcut', commandId, null)
4686
4691
  if (commandId.includes('moveLines')) {
@@ -12060,6 +12065,7 @@ G.shortcutAction = function shortcutAction(event) {
12060
12065
  if (key === 'b') return 'toggleSidebar'
12061
12066
  if (key === 'w') return 'closeTab'
12062
12067
  if (key === 'n') return 'newWindow'
12068
+ if (key === 'l') return 'selectAllOccurrences'
12063
12069
  if (isBackquote) return 'newTerminal'
12064
12070
  if (key === '/' || key === '?') return 'shortcuts'
12065
12071
  if (key === 'enter' || code === 'Enter' || code === 'NumpadEnter') return 'commit'
@@ -15037,6 +15043,9 @@ G.GufaApp = function GufaApp(props) {
15037
15043
  }
15038
15044
  G.bus.emit('terminal:clear')
15039
15045
  },
15046
+ selectAllOccurrences: () => {
15047
+ if (G.bus !== null && G.bus !== undefined && typeof G.bus.emit === 'function') G.bus.emit('editor:command', 'editor.action.selectHighlights')
15048
+ },
15040
15049
  toggleTerminal: () => patchUi({ terminalOpen: ui.terminalOpen !== true }),
15041
15050
  toggleSidebar: () => patchUi({ sidebarOpen: ui.sidebarOpen === false }),
15042
15051
  closeTab: () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-gufa-code",
3
- "version": "1.3.193",
3
+ "version": "1.3.194",
4
4
  "description": "古法编程 · AI 辅助:一键把 DSH 主面板变成 VS Code 风格 IDE(Monaco 编辑器、文件树、Git、SSH、真实终端 + 右侧官方会话);主张亲手写、每个改动心中有数,AI 是助理、你是第一责任人",
5
5
  "icon": "icon.svg",
6
6
  "keywords": [
@@ -717,14 +717,13 @@ const GUFA_LINT_ENABLED = true
717
717
  /** 显式绑定 Cmd/Ctrl+Shift+L = 选中当前词在文件里的所有匹配项(VS Code/Cursor 习惯)。 */
718
718
  function gufaBindSelectAllOccurrences(monacoInstance, editor) {
719
719
  try {
720
- editor.addAction({
721
- id: 'gufa.selectAllOccurrences',
722
- label: '选中所有匹配项',
723
- keybindings: [monacoInstance.KeyMod.CtrlCmd | monacoInstance.KeyMod.Shift | monacoInstance.KeyCode.KeyL],
724
- run: (target) => {
725
- try { target.trigger('gufa-select-occurrences', 'editor.action.selectHighlights', null) } catch { /* ignore */ }
720
+ /* addCommand 是底层键位绑定,比 addAction 更可靠(addAction 可能被同名内置 action 覆盖)。 */
721
+ editor.addCommand(
722
+ monacoInstance.KeyMod.CtrlCmd | monacoInstance.KeyMod.Shift | monacoInstance.KeyCode.KeyL,
723
+ () => {
724
+ try { editor.trigger('gufa-select-occurrences', 'editor.action.selectHighlights', null) } catch { /* ignore */ }
726
725
  },
727
- })
726
+ )
728
727
  } catch {
729
728
  /* ignore */
730
729
  }
@@ -2027,6 +2026,12 @@ const GUFA_LINT_ENABLED = true
2027
2026
  }
2028
2027
  const editor = editorRef.current
2029
2028
  const monaco = monacoRef.current
2029
+ if ((editor === null || editor === undefined) && diffEditorRef.current !== null && diffEditorRef.current !== undefined) {
2030
+ try {
2031
+ diffEditorRef.current.getModifiedEditor().trigger('gufa-shortcut', commandId, null)
2032
+ return
2033
+ } catch { /* ignore */ }
2034
+ }
2030
2035
  if (editor !== null && monaco !== null) {
2031
2036
  editor.trigger('gufa-shortcut', commandId, null)
2032
2037
  if (commandId.includes('moveLines')) {
@@ -52,6 +52,7 @@ G.shortcutAction = function shortcutAction(event) {
52
52
  if (key === 'b') return 'toggleSidebar'
53
53
  if (key === 'w') return 'closeTab'
54
54
  if (key === 'n') return 'newWindow'
55
+ if (key === 'l') return 'selectAllOccurrences'
55
56
  if (isBackquote) return 'newTerminal'
56
57
  if (key === '/' || key === '?') return 'shortcuts'
57
58
  if (key === 'enter' || code === 'Enter' || code === 'NumpadEnter') return 'commit'
@@ -2414,6 +2414,9 @@ G.GufaApp = function GufaApp(props) {
2414
2414
  }
2415
2415
  G.bus.emit('terminal:clear')
2416
2416
  },
2417
+ selectAllOccurrences: () => {
2418
+ if (G.bus !== null && G.bus !== undefined && typeof G.bus.emit === 'function') G.bus.emit('editor:command', 'editor.action.selectHighlights')
2419
+ },
2417
2420
  toggleTerminal: () => patchUi({ terminalOpen: ui.terminalOpen !== true }),
2418
2421
  toggleSidebar: () => patchUi({ sidebarOpen: ui.sidebarOpen === false }),
2419
2422
  closeTab: () => {