dsh-gufa-code 1.3.192 → 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 +28 -1
- package/package.json +1 -1
- package/src/client/20-editor.js +23 -0
- package/src/client/85-shortcuts.js +1 -0
- package/src/client/90-app.js +3 -0
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.194'
|
|
20
20
|
G.PANEL_ID = 'gufa-code'
|
|
21
21
|
/** 从哪个工作区点进来的(工作区菜单/节点按钮写入,App 启动时消费)。 */
|
|
22
22
|
G.pendingEntryWorkspace = null
|
|
@@ -3368,6 +3368,21 @@ const GUFA_LINT_ENABLED = true
|
|
|
3368
3368
|
|
|
3369
3369
|
/* ── 组件 ───────────────────────────────────────────────────────────── */
|
|
3370
3370
|
|
|
3371
|
+
/** 显式绑定 Cmd/Ctrl+Shift+L = 选中当前词在文件里的所有匹配项(VS Code/Cursor 习惯)。 */
|
|
3372
|
+
function gufaBindSelectAllOccurrences(monacoInstance, editor) {
|
|
3373
|
+
try {
|
|
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 */ }
|
|
3379
|
+
},
|
|
3380
|
+
)
|
|
3381
|
+
} catch {
|
|
3382
|
+
/* ignore */
|
|
3383
|
+
}
|
|
3384
|
+
}
|
|
3385
|
+
|
|
3371
3386
|
function GufaEditorPaneComponent(props) {
|
|
3372
3387
|
const tabs = useMemo(() => (Array.isArray(props.tabs) ? props.tabs : []), [props.tabs])
|
|
3373
3388
|
const activePath = typeof props.activePath === 'string' ? props.activePath : null
|
|
@@ -3616,6 +3631,7 @@ const GUFA_LINT_ENABLED = true
|
|
|
3616
3631
|
const instance = monaco.editor.create(host, gufaEditorOptions(propsRef.current.theme))
|
|
3617
3632
|
editor = instance
|
|
3618
3633
|
editorRef.current = instance
|
|
3634
|
+
gufaBindSelectAllOccurrences(monaco, instance)
|
|
3619
3635
|
try {
|
|
3620
3636
|
try {
|
|
3621
3637
|
G.__gufaEditorController = {
|
|
@@ -4544,6 +4560,7 @@ const GUFA_LINT_ENABLED = true
|
|
|
4544
4560
|
scrollbar: { verticalScrollbarSize: 10, horizontalScrollbarSize: 10 },
|
|
4545
4561
|
})
|
|
4546
4562
|
instance.setModel({ original: originalModel, modified: modifiedModel })
|
|
4563
|
+
try { gufaBindSelectAllOccurrences(monaco, instance.getModifiedEditor()) } catch { /* ignore */ }
|
|
4547
4564
|
} catch (error) {
|
|
4548
4565
|
try {
|
|
4549
4566
|
originalModel.dispose()
|
|
@@ -4663,6 +4680,12 @@ const GUFA_LINT_ENABLED = true
|
|
|
4663
4680
|
}
|
|
4664
4681
|
const editor = editorRef.current
|
|
4665
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
|
+
}
|
|
4666
4689
|
if (editor !== null && monaco !== null) {
|
|
4667
4690
|
editor.trigger('gufa-shortcut', commandId, null)
|
|
4668
4691
|
if (commandId.includes('moveLines')) {
|
|
@@ -12042,6 +12065,7 @@ G.shortcutAction = function shortcutAction(event) {
|
|
|
12042
12065
|
if (key === 'b') return 'toggleSidebar'
|
|
12043
12066
|
if (key === 'w') return 'closeTab'
|
|
12044
12067
|
if (key === 'n') return 'newWindow'
|
|
12068
|
+
if (key === 'l') return 'selectAllOccurrences'
|
|
12045
12069
|
if (isBackquote) return 'newTerminal'
|
|
12046
12070
|
if (key === '/' || key === '?') return 'shortcuts'
|
|
12047
12071
|
if (key === 'enter' || code === 'Enter' || code === 'NumpadEnter') return 'commit'
|
|
@@ -15019,6 +15043,9 @@ G.GufaApp = function GufaApp(props) {
|
|
|
15019
15043
|
}
|
|
15020
15044
|
G.bus.emit('terminal:clear')
|
|
15021
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
|
+
},
|
|
15022
15049
|
toggleTerminal: () => patchUi({ terminalOpen: ui.terminalOpen !== true }),
|
|
15023
15050
|
toggleSidebar: () => patchUi({ sidebarOpen: ui.sidebarOpen === false }),
|
|
15024
15051
|
closeTab: () => {
|
package/package.json
CHANGED
package/src/client/20-editor.js
CHANGED
|
@@ -714,6 +714,21 @@ const GUFA_LINT_ENABLED = true
|
|
|
714
714
|
|
|
715
715
|
/* ── 组件 ───────────────────────────────────────────────────────────── */
|
|
716
716
|
|
|
717
|
+
/** 显式绑定 Cmd/Ctrl+Shift+L = 选中当前词在文件里的所有匹配项(VS Code/Cursor 习惯)。 */
|
|
718
|
+
function gufaBindSelectAllOccurrences(monacoInstance, editor) {
|
|
719
|
+
try {
|
|
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 */ }
|
|
725
|
+
},
|
|
726
|
+
)
|
|
727
|
+
} catch {
|
|
728
|
+
/* ignore */
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
|
|
717
732
|
function GufaEditorPaneComponent(props) {
|
|
718
733
|
const tabs = useMemo(() => (Array.isArray(props.tabs) ? props.tabs : []), [props.tabs])
|
|
719
734
|
const activePath = typeof props.activePath === 'string' ? props.activePath : null
|
|
@@ -962,6 +977,7 @@ const GUFA_LINT_ENABLED = true
|
|
|
962
977
|
const instance = monaco.editor.create(host, gufaEditorOptions(propsRef.current.theme))
|
|
963
978
|
editor = instance
|
|
964
979
|
editorRef.current = instance
|
|
980
|
+
gufaBindSelectAllOccurrences(monaco, instance)
|
|
965
981
|
try {
|
|
966
982
|
try {
|
|
967
983
|
G.__gufaEditorController = {
|
|
@@ -1890,6 +1906,7 @@ const GUFA_LINT_ENABLED = true
|
|
|
1890
1906
|
scrollbar: { verticalScrollbarSize: 10, horizontalScrollbarSize: 10 },
|
|
1891
1907
|
})
|
|
1892
1908
|
instance.setModel({ original: originalModel, modified: modifiedModel })
|
|
1909
|
+
try { gufaBindSelectAllOccurrences(monaco, instance.getModifiedEditor()) } catch { /* ignore */ }
|
|
1893
1910
|
} catch (error) {
|
|
1894
1911
|
try {
|
|
1895
1912
|
originalModel.dispose()
|
|
@@ -2009,6 +2026,12 @@ const GUFA_LINT_ENABLED = true
|
|
|
2009
2026
|
}
|
|
2010
2027
|
const editor = editorRef.current
|
|
2011
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
|
+
}
|
|
2012
2035
|
if (editor !== null && monaco !== null) {
|
|
2013
2036
|
editor.trigger('gufa-shortcut', commandId, null)
|
|
2014
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'
|
package/src/client/90-app.js
CHANGED
|
@@ -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: () => {
|