dsh-vscode-mode 0.1.28 → 0.1.30
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/lib/client.js +859 -27
- package/lib/client.js.map +1 -1
- package/lib/index.js +513 -41
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/client/compat.ts +1 -1
- package/src/client/index.ts +15 -0
- package/src/client/keybindings.ts +169 -0
- package/src/client/monaco/diffRender.ts +7 -0
- package/src/client/rpc.ts +13 -2
- package/src/client/sidebar/panels/SearchPanel.ts +294 -0
- package/src/client/sidebar/panels/index.ts +18 -2
- package/src/client/sidebar/types.ts +2 -0
- package/src/client/styles/editor.css +40 -0
- package/src/client/styles/mcp.css +18 -0
- package/src/client/ui/EditorView.ts +76 -15
- package/src/client/ui/KeybindingsPanel.ts +187 -0
- package/src/client/ui/McpSettings.ts +7 -4
- package/src/client/ui/QuickOpen.ts +6 -3
- package/src/fileOpenSettings.ts +20 -4
- package/src/index.ts +4 -1
- package/src/rpc.ts +106 -22
- package/src/search/content.ts +319 -0
- package/src/search/fallback.ts +1 -1
- package/src/search/orchestrator.ts +17 -10
- package/src/search/ripgrep.ts +17 -2
- package/src/search/types.ts +40 -0
- package/src/shared/keybindings.ts +39 -0
- package/src/shared/rpc.ts +11 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dsh-vscode-mode shared — 快捷键命令目录与默认键位(双面契约)。
|
|
3
|
+
* 纯数据模块:host(settings schema 默认值)与 client(执行匹配/设置页)共用。
|
|
4
|
+
* 键位格式:修饰符 + 主键,`+` 连接,如 `Ctrl+Shift+F`;空串 = 未绑定。
|
|
5
|
+
* 作者 ddj 2026年08月26号
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/** 命令 id → 默认键位。命令目录以此为准,新增命令只需加一项。 */
|
|
9
|
+
export const KEYBINDING_DEFAULTS: Record<string, string> = {
|
|
10
|
+
'edrv.save': 'Ctrl+S',
|
|
11
|
+
'edrv.quickOpen': 'Ctrl+P',
|
|
12
|
+
'edrv.toggleSidebar': 'Ctrl+B',
|
|
13
|
+
'edrv.searchInFiles': 'Ctrl+Shift+F',
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* 返回默认键位的独立副本(调用方修改不污染目录)。
|
|
18
|
+
* @author ddj 2026年08月26号
|
|
19
|
+
* @returns 默认键位映射
|
|
20
|
+
*/
|
|
21
|
+
export function defaultKeybindings(): Record<string, string> {
|
|
22
|
+
return { ...KEYBINDING_DEFAULTS }
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* 规整外部键位数据:只保留已知命令 id 且为字符串的值,未知 id 丢弃。
|
|
27
|
+
* 防止用户文档/旧版本写入的未知命令污染执行匹配。
|
|
28
|
+
* @author ddj 2026年08月26号
|
|
29
|
+
* @param raw 原始设置值
|
|
30
|
+
* @returns 规整后的键位映射(缺省项不补默认值,由调用方按需合并)
|
|
31
|
+
*/
|
|
32
|
+
export function normalizeKeybindings(raw: unknown): Record<string, string> {
|
|
33
|
+
const out: Record<string, string> = {}
|
|
34
|
+
if (!raw || typeof raw !== 'object') return out
|
|
35
|
+
for (const [id, chord] of Object.entries(raw as Record<string, unknown>)) {
|
|
36
|
+
if (id in KEYBINDING_DEFAULTS && typeof chord === 'string') out[id] = chord
|
|
37
|
+
}
|
|
38
|
+
return out
|
|
39
|
+
}
|
package/src/shared/rpc.ts
CHANGED
|
@@ -29,6 +29,15 @@ export interface TreeEntry {
|
|
|
29
29
|
size?: number
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
/** 内容搜索单条命中(edrv.searchContent 返回;path 相对工作区根,列为 1-based UTF-16)。 */
|
|
33
|
+
export interface SearchContentMatch {
|
|
34
|
+
path: string
|
|
35
|
+
line: number
|
|
36
|
+
startColumn: number
|
|
37
|
+
endColumn: number
|
|
38
|
+
text: string
|
|
39
|
+
}
|
|
40
|
+
|
|
32
41
|
/** 一条批量决策项(decideBatch 的 items 元素,与 accept/reject 单条参数同构)。 */
|
|
33
42
|
export interface DecideItem {
|
|
34
43
|
callId: string
|
|
@@ -59,6 +68,7 @@ export interface RpcRequestMap {
|
|
|
59
68
|
'edrv.rollback': { sessionId?: string; path: string; batch?: number }
|
|
60
69
|
'edrv.debug': { sessionId?: string; text: string }
|
|
61
70
|
'edrv.searchFiles': { sessionId?: string; query: string }
|
|
71
|
+
'edrv.searchContent': { sessionId?: string; query: string; matchCase?: boolean; wholeWord?: boolean; regex?: boolean; maxResults?: number; include?: string[]; exclude?: string[] }
|
|
62
72
|
'edrv.listDir': { sessionId?: string; path: string }
|
|
63
73
|
'edrv.revealInExplorer': { sessionId?: string; path: string }
|
|
64
74
|
'mcp.list': {}
|
|
@@ -94,6 +104,7 @@ export interface RpcOkMap {
|
|
|
94
104
|
'edrv.rollback': { path: string; batch: number | null }
|
|
95
105
|
'edrv.debug': object
|
|
96
106
|
'edrv.searchFiles': { files: string[]; truncated: boolean }
|
|
107
|
+
'edrv.searchContent': { matches: SearchContentMatch[]; truncated: boolean }
|
|
97
108
|
'edrv.listDir': { root: string; path: string; entries: TreeEntry[] }
|
|
98
109
|
'edrv.revealInExplorer': { revealed: string }
|
|
99
110
|
'mcp.list': { servers: MpcServer[] }
|