dsh-vscode-mode 0.29.0 → 0.29.2
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 +27 -4
- package/lib/client.js +79 -38
- package/lib/client.js.map +1 -1
- package/lib/index.js +402 -182
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/client/styles/mcp.css +55 -14
- package/src/client/ui/AiSettings.ts +7 -5
- package/src/client/ui/IntegrationSettings.ts +8 -6
- package/src/client/ui/LspSettings.ts +2 -2
- package/src/client/ui/McpSettings.ts +26 -27
- package/src/client/ui/PerfSettings.ts +1 -1
- package/src/client/ui/SettingsUi.ts +44 -0
- package/src/client-primitives.d.ts +5 -0
- package/src/pending/hunks.ts +6 -150
- package/src/pending/lineDiff.ts +413 -0
- package/src/shared/review.ts +5 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-vscode-mode",
|
|
3
|
-
"version": "0.29.
|
|
3
|
+
"version": "0.29.2",
|
|
4
4
|
"description": "DSH 上的类 VSCode 编码体验:Monaco 编辑器(文件页签/QuickOpen/状态栏,可驻 DSH 0.1.5+ 官方右侧 Sidebar 与对话同屏)+ 命令栏(Ctrl+Shift+P)与可扩展指令系统 + VS Code 兼容代码片段(.code-snippets 全局/项目,IntelliSense 展开)+ Agent 编辑差异审查(整文件差异/采纳/拒绝/归档/回滚)+ SVN 集成(侧栏变更面板/日志弹窗/并排差异)+ 语言服务器(LSP)智能(跳转定义/引用/hover/大纲 + VSIX 扩展市场安装),状态持久化到工作区旁车,界面状态(页签/光标/侧栏/编辑 Tab/导航历史)镜像到 DSH home 跨重启恢复",
|
|
5
5
|
"icon": "assets/icon.svg",
|
|
6
6
|
"keywords": [
|
|
@@ -1,6 +1,42 @@
|
|
|
1
1
|
/* dsh-vscode-mode MCP 管理界面样式。
|
|
2
2
|
全部使用 DSH 真实主题变量(--dsw-alias-*),不再用不存在的 fg-* 变量。 */
|
|
3
|
-
.vsm-mcp-page{display:flex;flex-direction:column;gap:
|
|
3
|
+
.vsm-mcp-page{display:flex;flex-direction:column;gap:20px;width:100%;min-width:0;max-width:920px;box-sizing:border-box;color:var(--dsw-alias-label-primary,#20242c);padding-bottom:32px;font-family:inherit;font-size:13px;line-height:1.6;container-type:inline-size}
|
|
4
|
+
.vsm-settings-content,.vsm-settings-stack{min-width:0;display:flex;flex-direction:column;gap:20px}
|
|
5
|
+
.vsm-mcp-page :where(button,input,select,textarea){font-family:inherit;box-sizing:border-box;max-width:100%}
|
|
6
|
+
.vsm-mcp-page :where(button,input,select,textarea):focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4d6bfe);outline-offset:3px}
|
|
7
|
+
.vsm-mcp-page :where(input:not([type=checkbox]),select,textarea){min-width:0;min-height:32px;border:1px solid var(--dsw-alias-border-l2,#c8ccd4);border-radius:6px;padding:6px 10px;background:var(--dsw-alias-bg-layer-1,#fff);color:var(--dsw-alias-label-primary,#20242c);font-size:13px}
|
|
8
|
+
.vsm-mcp-page :where(button):disabled{cursor:not-allowed;opacity:.5}
|
|
9
|
+
.vsm-mcp-page :where(.vsm-general-row,.vsm-lsp-row,.vsm-perf-toolbar) button{min-height:30px}
|
|
10
|
+
.vsm-setting-row{display:grid;grid-template-columns:minmax(0,1fr) minmax(110px,42%);gap:12px 24px;align-items:center;padding:16px 0;border-bottom:1px solid var(--dsw-alias-border-l1,#e9e9e9)}
|
|
11
|
+
.vsm-setting-row:last-child{border-bottom:0}
|
|
12
|
+
.vsm-setting-copy{min-width:0}
|
|
13
|
+
.vsm-setting-copy label{font-size:13px;font-weight:500}
|
|
14
|
+
.vsm-general-page .vsm-setting-copy p{margin:4px 0 0;font-size:12px;line-height:1.6;color:var(--dsw-alias-label-secondary,#636b78);overflow-wrap:anywhere}
|
|
15
|
+
.vsm-setting-control{min-width:0;display:flex;justify-content:flex-end}
|
|
16
|
+
.vsm-setting-control>*,.vsm-setting-control input{width:100%;min-width:0}
|
|
17
|
+
/* Official Input owns its wrapper border; leave its inner input unframed. */
|
|
18
|
+
.vsm-mcp-page span>input{border:0;border-radius:0;padding:0;background:transparent;min-height:30px}
|
|
19
|
+
.vsm-setting-notice{padding:10px 12px;border-left:3px solid var(--dsw-alias-brand-primary,#4d6bfe);background:var(--dsw-alias-bg-layer-1,#f5f6f8);font-size:12px;overflow-wrap:anywhere}
|
|
20
|
+
.vsm-setting-notice.error{border-color:var(--dsw-alias-state-error-primary,#be3545);color:var(--dsw-alias-state-error-primary,#be3545)}
|
|
21
|
+
.vsm-ai-settings{display:flex;flex-direction:column;gap:14px;min-width:0}
|
|
22
|
+
.vsm-ai-settings h3{margin:0;font-size:14px;font-weight:600}
|
|
23
|
+
.vsm-ai-settings h3:not(:first-child){margin-top:16px;padding-top:24px;border-top:1px solid var(--dsw-alias-border-l1,#e9e9e9)}
|
|
24
|
+
.vsm-ai-settings .vsm-lsp-note{margin:0;color:var(--dsw-alias-label-secondary,#636b78);font-size:12px;line-height:1.7}
|
|
25
|
+
.vsm-ai-settings .vsm-lsp-row{display:flex;flex-wrap:wrap;gap:12px}
|
|
26
|
+
.vsm-ai-settings .vsm-lsp-row label{display:flex;flex:1 1 160px;min-width:0;flex-direction:column;gap:6px}
|
|
27
|
+
.vsm-ai-settings select{width:100%}
|
|
28
|
+
@container (max-width:440px){
|
|
29
|
+
.vsm-setting-row{grid-template-columns:minmax(0,1fr);gap:10px}
|
|
30
|
+
.vsm-setting-control{justify-content:flex-start}
|
|
31
|
+
.vsm-general-row{flex-wrap:wrap;gap:10px!important}
|
|
32
|
+
.vsm-general-row>span:first-child{flex-basis:100%}
|
|
33
|
+
.vsm-general-row>input,.vsm-general-row>select{flex:1 1 160px;width:100%}
|
|
34
|
+
.vsm-devform-actions{align-items:flex-start!important}
|
|
35
|
+
.vsm-mcp-card-head,.vsm-mcp-subhead,.vsm-compat-item{flex-wrap:wrap}
|
|
36
|
+
.vsm-compat-note{text-align:left!important}
|
|
37
|
+
.vsm-perf-card{min-width:80px!important;padding:8px!important}
|
|
38
|
+
}
|
|
39
|
+
@media(prefers-reduced-motion:reduce){.vsm-mcp-page *{transition:none!important;animation:none!important}}
|
|
4
40
|
|
|
5
41
|
/* 顶部:标题 + 副标题 + 添加按钮 */
|
|
6
42
|
.vsm-mcp-header{display:flex;align-items:flex-start;justify-content:space-between;gap:20px}
|
|
@@ -12,39 +48,43 @@
|
|
|
12
48
|
|
|
13
49
|
/* MCP 管理下的二级子页签:我的 MCP / 项目 MCP / MCP 市场 */
|
|
14
50
|
.vsm-mcp-subhead{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-top:-4px}
|
|
15
|
-
.vsm-mcp-subtabs{display:flex;gap:18px;border-bottom:1px solid var(--dsw-alias-border-l1,#2e2e2e);flex:1}
|
|
51
|
+
.vsm-mcp-subtabs{display:flex;flex-wrap:wrap;gap:0 18px;border-bottom:1px solid var(--dsw-alias-border-l1,#2e2e2e);flex:1}
|
|
16
52
|
.vsm-mcp-subtabs button{border:0;background:none;color:var(--dsw-alias-label-tertiary,#9aa5b1);padding:7px 2px 9px;cursor:pointer;font-size:13px;position:relative}
|
|
17
53
|
.vsm-mcp-subtabs button:hover{color:var(--dsw-alias-label-secondary,#c8c8c8)}
|
|
18
54
|
.vsm-mcp-subtabs button.active{color:var(--dsw-alias-label-primary,#fff);font-weight:500}
|
|
19
55
|
.vsm-mcp-subtabs button.active::after{content:"";position:absolute;left:0;right:0;bottom:-1px;height:2px;background:var(--dsw-alias-brand-primary,#6d55ff);border-radius:2px}
|
|
20
56
|
|
|
21
57
|
/* 顶层 Tab:通用 / MCP 管理 / 语言服务器 / AI 补全 / 性能优化 / 兼容性 */
|
|
22
|
-
.vsm-mcp-tabs{display:flex;gap:
|
|
58
|
+
.vsm-mcp-tabs{display:flex;flex-wrap:wrap;gap:0 18px;border-bottom:1px solid var(--dsw-alias-border-l1,#e9e9e9)}
|
|
23
59
|
.vsm-mcp-tabs button{border:0;background:none;color:var(--dsw-alias-label-tertiary,#9aa5b1);padding:9px 2px 11px;cursor:pointer;font-size:14px;position:relative}
|
|
24
60
|
.vsm-mcp-tabs button:hover{color:var(--dsw-alias-label-secondary,#c8c8c8)}
|
|
25
61
|
.vsm-mcp-tabs button.active{color:var(--dsw-alias-label-primary,#fff);font-weight:500}
|
|
26
62
|
.vsm-mcp-tabs button.active::after{content:"";position:absolute;left:0;right:0;bottom:-1px;height:2px;background:var(--dsw-alias-brand-primary,#6d55ff);border-radius:2px}
|
|
27
63
|
|
|
28
|
-
/*
|
|
29
|
-
|
|
30
|
-
.vsm-panel{border:1px solid var(--dsw-alias-border-l2,#3a3a3a);border-radius:12px;background:var(--dsw-alias-bg-layer-2,transparent);overflow:hidden}
|
|
64
|
+
/* 设置分组用标题、留白与轻分隔线组织,不叠加厚重卡片。 */
|
|
65
|
+
.vsm-panel{min-width:0;border:0;border-radius:0;background:transparent;overflow:visible}
|
|
31
66
|
.vsm-panel-pad{padding:14px 16px}
|
|
32
|
-
.vsm-panel-title{margin:0;padding:10px
|
|
33
|
-
.vsm-panel-body{padding:
|
|
67
|
+
.vsm-panel-title{margin:0;padding:0 0 10px;font-size:14px;font-weight:600;color:var(--dsw-alias-label-primary,#20242c);background:transparent;border-bottom:1px solid var(--dsw-alias-border-l1,#e9e9e9)}
|
|
68
|
+
.vsm-panel-body{padding:0;min-width:0;overflow-wrap:anywhere}
|
|
34
69
|
.vsm-panel-body>*:first-child{margin-top:8px}
|
|
35
70
|
.vsm-panel-body>*:last-child{margin-bottom:10px}
|
|
36
71
|
|
|
37
72
|
/* 通用设置 */
|
|
38
|
-
.vsm-general-page{display:flex;flex-direction:column;gap:
|
|
73
|
+
.vsm-general-page{display:flex;flex-direction:column;gap:28px;max-width:100%;min-width:0}
|
|
39
74
|
.vsm-general-page h2{margin:0;font-size:20px;color:var(--dsw-alias-label-primary,#e6e6e6)}
|
|
40
75
|
.vsm-general-page p{margin:0;color:var(--dsw-alias-label-tertiary,#9aa5b1);font-size:13px}
|
|
41
|
-
.vsm-general-row{display:flex;align-items:center;justify-content:space-between;gap:
|
|
76
|
+
.vsm-general-row{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:16px 0;border-bottom:1px solid var(--dsw-alias-border-l1,#e9e9e9);color:var(--dsw-alias-label-primary,#20242c);font-size:13px;min-width:0}
|
|
77
|
+
.vsm-general-row>span:first-child{min-width:0;flex:1 1 45%;overflow-wrap:anywhere}
|
|
78
|
+
.vsm-general-row>input,.vsm-general-row>select{width:46%;min-width:0;flex-shrink:1}
|
|
79
|
+
.vsm-general-row>small{flex:1 1 30%;font-size:12px;line-height:1.6}
|
|
80
|
+
.vsm-general-row>span:has(>input){flex:1 1 160px;min-width:0}
|
|
81
|
+
.vsm-general-row>span>input{width:100%}
|
|
42
82
|
.vsm-general-row:last-child{border-bottom:0}
|
|
43
|
-
.vsm-general-row select{min-width:
|
|
83
|
+
.vsm-general-row select{min-width:0;padding:8px 10px;border:1px solid var(--dsw-alias-border-l2,#555);border-radius:6px;background:var(--dsw-alias-bg-layer-1,#2b2b2b);color:var(--dsw-alias-label-primary,#eee);font:inherit}
|
|
44
84
|
.vsm-general-row small{color:var(--dsw-alias-label-tertiary,#9aa5b1)}
|
|
45
85
|
|
|
46
86
|
/* 服务卡片 */
|
|
47
|
-
.vsm-mcp-card{border:1px solid var(--dsw-alias-border-
|
|
87
|
+
.vsm-mcp-card{border:1px solid var(--dsw-alias-border-l1,#e9e9e9);border-radius:8px;padding:14px 16px;margin-bottom:10px;background:transparent;min-width:0}
|
|
48
88
|
.vsm-mcp-card:hover{border-color:var(--dsw-alias-border-l3,#555)}
|
|
49
89
|
.vsm-mcp-card-head{display:flex;justify-content:space-between;align-items:center;gap:12px}
|
|
50
90
|
.vsm-mcp-title{display:flex;align-items:center;gap:9px;font-weight:600;font-size:14px;color:var(--dsw-alias-label-primary,#e6e6e6);min-width:0}
|
|
@@ -71,7 +111,7 @@
|
|
|
71
111
|
.vsm-mcp-chip{font:12px var(--ds-font-family-code,ui-monospace,monospace);padding:4px 8px;border-radius:5px;background:var(--dsw-alias-bg-mask-2,#ffffff14);color:var(--dsw-alias-label-secondary,#c8c8c8);border:1px solid var(--dsw-alias-border-l1,#333)}
|
|
72
112
|
|
|
73
113
|
/* 空态 / 加载态 */
|
|
74
|
-
.vsm-mcp-empty{text-align:
|
|
114
|
+
.vsm-mcp-empty{text-align:left;padding:24px 16px;color:var(--dsw-alias-label-tertiary,#9aa5b1);border:1px dashed var(--dsw-alias-border-l2,#3a3a3a);border-radius:8px;font-size:13px}
|
|
75
115
|
|
|
76
116
|
/* 项目搜索下拉框 */
|
|
77
117
|
.vsm-project-picker{position:relative;width:100%;z-index:4}
|
|
@@ -125,7 +165,8 @@
|
|
|
125
165
|
/* 开发形态开关 */
|
|
126
166
|
.vsm-devform-note{display:block;margin-top:4px;font-size:11px;color:var(--dsw-alias-label-tertiary,#9aa5b1);word-break:break-all}
|
|
127
167
|
.vsm-devform-actions{display:flex;flex-direction:column;align-items:flex-end;gap:6px;min-width:0}
|
|
128
|
-
.vsm-devform-msg{color:var(--dsw-alias-
|
|
168
|
+
.vsm-devform-msg{color:var(--dsw-alias-label-secondary,#636b78);font-size:12px;text-align:left;line-height:1.6}
|
|
169
|
+
.vsm-mcp-page button.vsm-danger{color:var(--dsw-alias-state-error-primary,#be3545)}
|
|
129
170
|
.vsm-general-row button{border:1px solid var(--dsw-alias-border-l2,#555);border-radius:6px;padding:6px 12px;background:none;color:var(--dsw-alias-label-primary,#eee);cursor:pointer;font-size:12px;white-space:nowrap}
|
|
130
171
|
.vsm-general-row button:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover,#ffffff14)}
|
|
131
172
|
.vsm-general-row button:disabled{opacity:.55;cursor:default}
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
* 作者 ddj
|
|
10
10
|
*/
|
|
11
11
|
import React from 'react'
|
|
12
|
+
import { Button } from '@deepseek-ai/dsh-client-ui-primitives'
|
|
13
|
+
import { SettingNotice } from './SettingsUi.js'
|
|
12
14
|
import { rpc } from '../rpc.js'
|
|
13
15
|
import { setAiInlineEnabled } from '../ai/inlineProvider.js'
|
|
14
16
|
import { isDelistedModel } from '../../shared/ai.js'
|
|
@@ -98,7 +100,7 @@ export function AiSettings() {
|
|
|
98
100
|
// 仅提示,不擅自改写用户已保存的配置(避免覆盖其意图);清空即回到自动路由。
|
|
99
101
|
const delisted = isDelistedModel(cfg.model)
|
|
100
102
|
const taskDelisted = isDelistedModel(cfg.taskModel)
|
|
101
|
-
return React.createElement('section', { className: 'vsm-
|
|
103
|
+
return React.createElement('section', { className: 'vsm-ai-settings' },
|
|
102
104
|
React.createElement('h3', null, 'AI 自动补全(实验)'),
|
|
103
105
|
React.createElement('p', { className: 'vsm-lsp-note' }, '编辑停顿后由模型生成内联建议(ghost text),Tab 接受,Alt+\\ 手动触发。每次补全是一次模型调用;建议选择非推理模型,且思考强度选「跟随默认」或最低档以获得更快响应。'),
|
|
104
106
|
(delisted
|
|
@@ -106,7 +108,7 @@ export function AiSettings() {
|
|
|
106
108
|
'当前模型「' + cfg.model + '」已从 DSH 默认模型列表移除(0.1.6-alpha.2 起)。该模型可能不再可用;将「模型」改回「自动」即可使用第一个可用模型(现有配置不会被自动改动)。')
|
|
107
109
|
: null),
|
|
108
110
|
React.createElement('div', { className: 'vsm-lsp-row' },
|
|
109
|
-
React.createElement(
|
|
111
|
+
React.createElement(Button, { variant: cfg.enabled ? 'primary' : 'outline', size: 'sm', 'aria-pressed': cfg.enabled, disabled: busy, onClick: toggle },
|
|
110
112
|
cfg.enabled ? '已开启(点击关闭)' : '已关闭(点击开启)'),
|
|
111
113
|
),
|
|
112
114
|
React.createElement('div', { className: 'vsm-lsp-row' },
|
|
@@ -121,7 +123,7 @@ export function AiSettings() {
|
|
|
121
123
|
efforts.map((e) => React.createElement('option', { key: e.id, value: e.id }, e.name))),
|
|
122
124
|
) : null,
|
|
123
125
|
),
|
|
124
|
-
React.createElement('h3', null, 'AI
|
|
126
|
+
React.createElement('h3', null, 'AI 任务模型'),
|
|
125
127
|
React.createElement('p', { className: 'vsm-lsp-note' }, '独立于补全模型:整理分析可选推理模型 + 较高思考强度,补全仍可选快模型。留空 = 跟随补全模型配置。'),
|
|
126
128
|
(taskDelisted
|
|
127
129
|
? React.createElement('div', { className: 'vsm-mcp-error vsm-mcp-banner' },
|
|
@@ -139,7 +141,7 @@ export function AiSettings() {
|
|
|
139
141
|
taskEfforts.map((e) => React.createElement('option', { key: e.id, value: e.id }, e.name))),
|
|
140
142
|
) : null,
|
|
141
143
|
),
|
|
142
|
-
|
|
143
|
-
|
|
144
|
+
React.createElement(SettingNotice, { message: note }),
|
|
145
|
+
React.createElement(SettingNotice, { message: error, error: true }),
|
|
144
146
|
)
|
|
145
147
|
}
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
* 作者 ddj 2026-09-07
|
|
9
9
|
*/
|
|
10
10
|
import React from 'react'
|
|
11
|
+
import { Button, Input } from '@deepseek-ai/dsh-client-ui-primitives'
|
|
12
|
+
import { SettingNotice } from './SettingsUi.js'
|
|
11
13
|
import { rpc } from '../rpc.js'
|
|
12
14
|
import { SettingsContext } from '../settingsContext.js'
|
|
13
15
|
|
|
@@ -184,19 +186,19 @@ export function IntegrationSettings() {
|
|
|
184
186
|
React.createElement('h3', { className: 'vsm-panel-title' }, '系统集成'),
|
|
185
187
|
React.createElement('div', { className: 'vsm-panel-body' },
|
|
186
188
|
React.createElement('p', { style: { margin: '0 0 8px' } },
|
|
187
|
-
'
|
|
188
|
-
|
|
189
|
-
|
|
189
|
+
'从文件管理器或 Unity 直接打开 DSH 编辑器。Unity 使用内嵌包,无需修改项目 manifest。'),
|
|
190
|
+
React.createElement(SettingNotice, { message: error, error: true }),
|
|
191
|
+
React.createElement(SettingNotice, { message }),
|
|
190
192
|
status && !onWin && React.createElement(PlatformNote, { platform, registered: anyRegistered }),
|
|
191
193
|
React.createElement('label', { className: 'vsm-general-row' },
|
|
192
194
|
React.createElement('span', null, 'DSH 服务地址'),
|
|
193
|
-
React.createElement(
|
|
195
|
+
React.createElement(Input, {
|
|
194
196
|
value: baseDraft ?? baseUrl,
|
|
195
197
|
placeholder: 'http://127.0.0.1:3080',
|
|
196
198
|
onChange: (event) => setBaseDraft(event.target.value),
|
|
197
199
|
onKeyDown: (event) => { if (event.key === 'Enter') saveBase() },
|
|
198
200
|
}),
|
|
199
|
-
React.createElement('
|
|
201
|
+
React.createElement(Button, { variant: 'outline', size: 'sm', disabled: busy === 'base' || baseDraft === null, onClick: saveBase }, '保存地址'),
|
|
200
202
|
),
|
|
201
203
|
React.createElement('label', { className: 'vsm-general-row' },
|
|
202
204
|
React.createElement('span', null,
|
|
@@ -229,7 +231,7 @@ export function IntegrationSettings() {
|
|
|
229
231
|
})),
|
|
230
232
|
React.createElement('label', { className: 'vsm-general-row' },
|
|
231
233
|
React.createElement('span', null, '添加 Unity 项目'),
|
|
232
|
-
React.createElement(
|
|
234
|
+
React.createElement(Input, {
|
|
233
235
|
value: rootDraft,
|
|
234
236
|
placeholder: '项目根目录(含 Assets 与 ProjectSettings)',
|
|
235
237
|
onChange: (event) => setRootDraft(event.target.value),
|
|
@@ -357,7 +357,7 @@ export function LspSettings() {
|
|
|
357
357
|
}
|
|
358
358
|
|
|
359
359
|
if (loading) return React.createElement('div', { className: 'vsm-mcp-empty' }, '正在读取语言服务器状态…')
|
|
360
|
-
const nav = React.createElement('nav', { className: 'vsm-mcp-
|
|
360
|
+
const nav = React.createElement('nav', { className: 'vsm-mcp-subtabs', 'aria-label': '语言服务器分类' },
|
|
361
361
|
TABS.map((t) => React.createElement('button', { key: t.id, className: tab === t.id ? 'active' : '', onClick: () => switchTab(t.id) }, t.label)))
|
|
362
362
|
const header = React.createElement('div', { className: 'vsm-mcp-header' },
|
|
363
363
|
React.createElement('div', null,
|
|
@@ -420,5 +420,5 @@ export function LspSettings() {
|
|
|
420
420
|
React.createElement('button', { className: 'vsm-primary vsm-small', disabled: busy === u.id, onClick: () => updateExt(u) }, busy === u.id ? '更新中…' : '更新')))))
|
|
421
421
|
: React.createElement('div', { className: 'vsm-mcp-empty' }, '全部已是最新')))
|
|
422
422
|
}
|
|
423
|
-
return React.createElement('div',
|
|
423
|
+
return React.createElement('div', { className: 'vsm-settings-stack' }, header, nav, banner, body)
|
|
424
424
|
}
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
* 作者 ddj 2026年08月22号 / 2026年08月26号 / 2026年08月27号 / 2026年10月
|
|
8
8
|
*/
|
|
9
9
|
import React from 'react'
|
|
10
|
+
import { Button, Input } from '@deepseek-ai/dsh-client-ui-primitives'
|
|
11
|
+
import { SettingRow, SettingNotice } from './SettingsUi.js'
|
|
10
12
|
import { rpc } from '../rpc.js'
|
|
11
13
|
import type { MpcProject, MpcServer } from '../../shared/mcp.js'
|
|
12
14
|
import { configOf } from '../mcpForm.js'
|
|
@@ -273,24 +275,21 @@ function GeneralSettings({ registry, getShortcuts }) {
|
|
|
273
275
|
),
|
|
274
276
|
)
|
|
275
277
|
return React.createElement('section', { className: 'vsm-general-page' },
|
|
276
|
-
|
|
277
|
-
React.createElement('p', null, '配置 DSH 对话中文件链接的打开工具。工具由当前运行时自动扫描。'),
|
|
278
|
+
|
|
278
279
|
unavailable && React.createElement('div', { className: 'vsm-mcp-error vsm-mcp-banner' }, '设置服务暂不可用,当前使用自动选择。'),
|
|
279
280
|
error && React.createElement('div', { className: 'vsm-mcp-error vsm-mcp-banner' }, error),
|
|
280
281
|
React.createElement('section', { className: 'vsm-panel' },
|
|
281
|
-
React.createElement('h3', { className: 'vsm-panel-title' }, '
|
|
282
|
+
React.createElement('h3', { className: 'vsm-panel-title' }, '文件打开'),
|
|
282
283
|
React.createElement('div', { className: 'vsm-panel-body' },
|
|
283
284
|
React.createElement('label', { className: 'vsm-general-row' }, React.createElement('span', null, '文件链接使用工具'), React.createElement('select', { value: currentOption, disabled: loading || unavailable || notReady || busy || snapshot?.writable === false, onChange: (event) => save(event.target.value) }, options.map((item) => React.createElement('option', { key: item.id, value: item.id }, item.label))), loading && React.createElement('small', null, '读取中…')),
|
|
284
|
-
|
|
285
|
-
updateRow,
|
|
285
|
+
|
|
286
286
|
),
|
|
287
287
|
),
|
|
288
288
|
React.createElement('section', { className: 'vsm-panel' },
|
|
289
289
|
React.createElement('h3', { className: 'vsm-panel-title' }, '编辑器'),
|
|
290
290
|
React.createElement('div', { className: 'vsm-panel-body' },
|
|
291
|
-
React.createElement(
|
|
292
|
-
React.createElement(
|
|
293
|
-
React.createElement('input', {
|
|
291
|
+
React.createElement(SettingRow, { label: '侧边栏最小宽度', description: '180–560 px;拖拽低于此宽度时自动隐藏。' },
|
|
292
|
+
React.createElement(Input, {
|
|
294
293
|
type: 'number', min: 180, max: 560, step: 10,
|
|
295
294
|
value: minDraft ?? minW,
|
|
296
295
|
disabled: loading || unavailable || notReady || busy || snapshot?.writable === false,
|
|
@@ -298,11 +297,9 @@ function GeneralSettings({ registry, getShortcuts }) {
|
|
|
298
297
|
onChange: (event) => setMinDraft(event.target.value),
|
|
299
298
|
onBlur: commitMinW,
|
|
300
299
|
onKeyDown: (event) => { if (event.key === 'Enter') commitMinW() },
|
|
301
|
-
}),
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
React.createElement('span', null, '页签数量上限'),
|
|
305
|
-
React.createElement('input', {
|
|
300
|
+
})),
|
|
301
|
+
React.createElement(SettingRow, { label: '页签数量上限', description: '0 表示不限制;超限时关闭最久未使用的页签,固定页签除外。' },
|
|
302
|
+
React.createElement(Input, {
|
|
306
303
|
type: 'number', min: 0, max: EDITOR_LIMIT_CEIL, step: 1,
|
|
307
304
|
value: limitDraft ?? limit,
|
|
308
305
|
disabled: loading || unavailable || notReady || busy || snapshot?.writable === false,
|
|
@@ -310,11 +307,9 @@ function GeneralSettings({ registry, getShortcuts }) {
|
|
|
310
307
|
onChange: (event) => setLimitDraft(event.target.value),
|
|
311
308
|
onBlur: commitLimit,
|
|
312
309
|
onKeyDown: (event) => { if (event.key === 'Enter') commitLimit() },
|
|
313
|
-
}),
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
React.createElement('span', null, '原生打开范围'),
|
|
317
|
-
React.createElement('input', {
|
|
310
|
+
})),
|
|
311
|
+
React.createElement(SettingRow, { label: '原生预览文件类型', description: '后缀以逗号分隔;留空恢复默认 Office 与二进制类型。CSV、TSV 需显式加入。' },
|
|
312
|
+
React.createElement(Input, {
|
|
318
313
|
type: 'text',
|
|
319
314
|
value: nativeDraft ?? nativeSaved,
|
|
320
315
|
disabled: loading || unavailable || notReady || busy || snapshot?.writable === false,
|
|
@@ -323,8 +318,7 @@ function GeneralSettings({ registry, getShortcuts }) {
|
|
|
323
318
|
onChange: (event) => setNativeDraft(event.target.value),
|
|
324
319
|
onBlur: commitNative,
|
|
325
320
|
onKeyDown: (event) => { if (event.key === 'Enter') commitNative() },
|
|
326
|
-
}),
|
|
327
|
-
React.createElement('small', null, '逗号分隔;命中的文件用 DSH 原生预览打开,留空恢复默认(Office + 二进制,csv/tsv 需显式加入)')),
|
|
321
|
+
})),
|
|
328
322
|
),
|
|
329
323
|
),
|
|
330
324
|
React.createElement('section', { className: 'vsm-panel' },
|
|
@@ -333,10 +327,13 @@ function GeneralSettings({ registry, getShortcuts }) {
|
|
|
333
327
|
React.createElement('label', { className: 'vsm-general-row' },
|
|
334
328
|
React.createElement('span', null, '键位配置',
|
|
335
329
|
React.createElement('small', { className: 'vsm-devform-note' },
|
|
336
|
-
'
|
|
337
|
-
React.createElement('
|
|
330
|
+
'在官方快捷键面板统一配置插件与 DSH 命令,支持录键、冲突检查及恢复默认。')),
|
|
331
|
+
React.createElement(Button, { variant: 'outline', size: 'sm', onClick: openShortcuts }, '配置快捷键')),
|
|
338
332
|
kbMessage && React.createElement('small', { className: 'vsm-devform-msg' }, kbMessage)),
|
|
339
333
|
),
|
|
334
|
+
React.createElement('section', { className: 'vsm-panel' },
|
|
335
|
+
React.createElement('h3', { className: 'vsm-panel-title' }, '安装与更新'),
|
|
336
|
+
React.createElement('div', { className: 'vsm-panel-body' }, devFormRow, updateRow)),
|
|
340
337
|
React.createElement(SvnSettingsSection, null),
|
|
341
338
|
React.createElement(IntegrationSettings, null),
|
|
342
339
|
)
|
|
@@ -689,7 +686,7 @@ export function McpSettings(props) {
|
|
|
689
686
|
/** @author ddj 2026年10月08号 @description Reset the draft when no mutation is pending. */
|
|
690
687
|
const resetDraft = () => { if (!ref.current?.view.busy) setDraft(EMPTY) }
|
|
691
688
|
let body
|
|
692
|
-
if (loading) body = React.createElement('div', { className: 'vsm-mcp-empty' }, '正在读取 MCP 服务…')
|
|
689
|
+
if (tab === 'mcp' && loading) body = React.createElement('div', { className: 'vsm-mcp-empty' }, '正在读取 MCP 服务…')
|
|
693
690
|
else if (tab === 'general') body = React.createElement(GeneralSettings, { registry: openerRegistry, getShortcuts })
|
|
694
691
|
else if (tab === 'mcp') body = React.createElement(McpManagePanel, { servers, projects, busy, draft, edit, resetDraft,
|
|
695
692
|
saveGlobal, saveProject, connectProject, policyProject,
|
|
@@ -699,10 +696,12 @@ export function McpSettings(props) {
|
|
|
699
696
|
else if (tab === 'ai') body = React.createElement(AiSettings, null)
|
|
700
697
|
else body = React.createElement(PerfSettings, null)
|
|
701
698
|
return React.createElement('section', { className: 'vsm-mcp-page' },
|
|
702
|
-
React.createElement('header', { className: 'vsm-mcp-header' }, React.createElement('div', null, React.createElement('h2', null, 'VSCodeMode'), React.createElement('p', null, '
|
|
703
|
-
React.createElement('nav', { className: 'vsm-mcp-tabs'
|
|
704
|
-
|
|
705
|
-
|
|
699
|
+
React.createElement('header', { className: 'vsm-mcp-header' }, React.createElement('div', null, React.createElement('h2', null, 'VSCodeMode'), React.createElement('p', null, '编辑器偏好、开发工具与系统集成。'))),
|
|
700
|
+
React.createElement('nav', { className: 'vsm-mcp-tabs', 'aria-label': 'VSCodeMode 设置分类' },
|
|
701
|
+
[['general', '通用'], ['mcp', 'MCP 管理'], ['lsp', '语言服务器'], ['ai', 'AI 补全'], ['perf', '性能优化'], ['compat', '兼容性']].map(([id, label]) =>
|
|
702
|
+
React.createElement('button', { key: id, type: 'button', className: tab === id ? 'active' : '', 'aria-current': tab === id ? 'page' : undefined, 'aria-controls': 'vsm-settings-content', onClick: () => setTab(id) }, label))),
|
|
703
|
+
tab === 'mcp' && React.createElement(SettingNotice, { message: error, error: true }),
|
|
704
|
+
React.createElement('div', { className: 'vsm-settings-content', id: 'vsm-settings-content' }, body),
|
|
706
705
|
)
|
|
707
706
|
}
|
|
708
707
|
|
|
@@ -341,7 +341,7 @@ export function PerfSettings() {
|
|
|
341
341
|
React.createElement('button', { className: 'vsm-secondary vsm-small', onClick: clearSel, disabled: !selCount }, '清空选择'),
|
|
342
342
|
React.createElement('span', { className: 'vsm-perf-selcount' }, '已选 ' + selCount + ' 个'),
|
|
343
343
|
React.createElement('button', { className: 'vsm-primary vsm-small', onClick: planMove, disabled: !selCount || busy === 'plan' }, busy === 'plan' ? '规划中…' : '移出所选'),
|
|
344
|
-
React.createElement('button', { className: 'vsm-secondary vsm-small', onClick: doPurge, disabled: busy === 'purge' }, '
|
|
344
|
+
React.createElement('button', { className: 'vsm-secondary vsm-small vsm-danger', onClick: doPurge, disabled: busy === 'purge' }, '清除 30 天前的归档'),
|
|
345
345
|
React.createElement('button', { className: 'vsm-secondary vsm-small', onClick: load, disabled: busy === 'load' }, '⟳ 刷新'),
|
|
346
346
|
),
|
|
347
347
|
workspacePager,
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import type { ReactElement, ReactNode } from 'react'
|
|
3
|
+
|
|
4
|
+
interface SettingRowProps {
|
|
5
|
+
label: string
|
|
6
|
+
description?: string
|
|
7
|
+
children: ReactElement<{ id?: string; 'aria-describedby'?: string }>
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @public
|
|
12
|
+
* @author ddj 2026年11月12号
|
|
13
|
+
* @description Associate setting help with its control without squeezing long labels.
|
|
14
|
+
* @param props Field name, help text and one control.
|
|
15
|
+
* @returns Responsive accessible settings row.
|
|
16
|
+
*/
|
|
17
|
+
export function SettingRow(props: SettingRowProps): ReactElement {
|
|
18
|
+
const fieldId = React.useId()
|
|
19
|
+
const helpId = fieldId + '-help'
|
|
20
|
+
const describedBy = [props.children.props['aria-describedby'], props.description ? helpId : undefined].filter(Boolean).join(' ')
|
|
21
|
+
const control = React.cloneElement(props.children, { id: fieldId, 'aria-describedby': describedBy || undefined })
|
|
22
|
+
|
|
23
|
+
return React.createElement('div', { className: 'vsm-setting-row' },
|
|
24
|
+
React.createElement('div', { className: 'vsm-setting-copy' },
|
|
25
|
+
React.createElement('label', { htmlFor: fieldId }, props.label),
|
|
26
|
+
props.description && React.createElement('p', { id: helpId }, props.description)),
|
|
27
|
+
React.createElement('div', { className: 'vsm-setting-control' }, control))
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @public
|
|
32
|
+
* @author ddj 2026年11月12号
|
|
33
|
+
* @description Announce results without moving focus or disguising errors.
|
|
34
|
+
* @param props Result content and optional error severity.
|
|
35
|
+
* @returns Inline status, alert or nothing.
|
|
36
|
+
*/
|
|
37
|
+
export function SettingNotice(props: { message: ReactNode; error?: boolean }): ReactElement | null {
|
|
38
|
+
if (!props.message) return null
|
|
39
|
+
|
|
40
|
+
return React.createElement('div', {
|
|
41
|
+
className: props.error ? 'vsm-setting-notice error' : 'vsm-setting-notice',
|
|
42
|
+
role: props.error ? 'alert' : 'status',
|
|
43
|
+
}, props.message)
|
|
44
|
+
}
|
|
@@ -7,6 +7,11 @@
|
|
|
7
7
|
* 作者 ddj 2026-09-10
|
|
8
8
|
*/
|
|
9
9
|
declare module '@deepseek-ai/dsh-client-ui-primitives' {
|
|
10
|
+
/** Theme-backed input wrapper; native attributes reach input. @author ddj 2026年11月12号 */
|
|
11
|
+
export const Input: import('react').ComponentType<import('react').InputHTMLAttributes<HTMLInputElement> & {
|
|
12
|
+
icon?: import('react').ReactNode
|
|
13
|
+
}>
|
|
14
|
+
|
|
10
15
|
/** Compact theme-backed button; mirrors official Button.d.ts. @author ddj 2026年10月27号 */
|
|
11
16
|
export const Button: import('react').ComponentType<import('react').ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
12
17
|
variant?: 'primary' | 'ghost' | 'outline' | 'toolbar'
|
package/src/pending/hunks.ts
CHANGED
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 待审差异构造:把两侧全文变成官方视图复用的 hunk,并提供块级 Keep/Revert 的文本合成。
|
|
3
|
+
* 行差异交给 lineDiff 引擎(唯一行锚点切分 + 小窗口 LCS),只有真整段替换才标 coarse。
|
|
3
4
|
* @author ddj 2026年10月29号
|
|
4
5
|
*/
|
|
5
|
-
import type { OfficialDiff
|
|
6
|
+
import type { OfficialDiff } from '../shared/review.js'
|
|
6
7
|
import type { ReviewBlock } from '../shared/reviewRegions.js'
|
|
7
8
|
import { logicalLines } from '../shared/lineEndings.js'
|
|
8
|
-
|
|
9
|
-
/** 每个 hunk 的上下文行数。 */
|
|
10
|
-
const CONTEXT = 3
|
|
11
|
-
/** LCS 单元格上限:超过后退化为整段替换,避免大文件卡死。 */
|
|
12
|
-
const CELL_LIMIT = 1_000_000
|
|
13
|
-
|
|
14
|
-
/** 一行差异操作。 */
|
|
15
|
-
type LineOp = { kind: ' ' | '-' | '+'; text: string }
|
|
9
|
+
import { lineHunks } from './lineDiff.js'
|
|
16
10
|
|
|
17
11
|
/**
|
|
18
12
|
* @author ddj 2026年10月29号
|
|
@@ -21,11 +15,11 @@ type LineOp = { kind: ' ' | '-' | '+'; text: string }
|
|
|
21
15
|
* @param display 展示名
|
|
22
16
|
* @param oldText 基线全文
|
|
23
17
|
* @param newText 当前全文
|
|
24
|
-
* @returns
|
|
18
|
+
* @returns 文本差异;coarse 表示比较中确有区域退化为整段替换
|
|
25
19
|
*/
|
|
26
20
|
export function textDiff(path: string, display: string, oldText: string, newText: string): OfficialDiff {
|
|
27
|
-
const hunks =
|
|
28
|
-
return { kind: 'text', path, display, before: true, after: true, hunks, coarse:
|
|
21
|
+
const { hunks, degraded } = lineHunks(logicalLines(oldText), logicalLines(newText))
|
|
22
|
+
return { kind: 'text', path, display, before: true, after: true, hunks, coarse: degraded }
|
|
29
23
|
}
|
|
30
24
|
|
|
31
25
|
/**
|
|
@@ -101,141 +95,3 @@ function locateSpan(lines: string[], pattern: string[]): number | null {
|
|
|
101
95
|
}
|
|
102
96
|
return at >= 0 ? at : null
|
|
103
97
|
}
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* @author ddj 2026年10月29号
|
|
107
|
-
* @description: 生成带上下文的标准 hunk 列表。
|
|
108
|
-
* @param oldLines 基线行
|
|
109
|
-
* @param newLines 当前行
|
|
110
|
-
* @returns hunk 列表
|
|
111
|
-
*/
|
|
112
|
-
function buildHunks(oldLines: string[], newLines: string[]): ReviewHunk[] {
|
|
113
|
-
const ops = diffLines(oldLines, newLines)
|
|
114
|
-
const hunks: ReviewHunk[] = []
|
|
115
|
-
let index = 0
|
|
116
|
-
let oldLine = 0
|
|
117
|
-
let newLine = 0
|
|
118
|
-
while (index < ops.length) {
|
|
119
|
-
if (ops[index].kind === ' ') {
|
|
120
|
-
oldLine++
|
|
121
|
-
newLine++
|
|
122
|
-
index++
|
|
123
|
-
continue
|
|
124
|
-
}
|
|
125
|
-
const head = ops.slice(Math.max(0, index - CONTEXT), index)
|
|
126
|
-
const collected: LineOp[] = []
|
|
127
|
-
let probe = index
|
|
128
|
-
while (probe < ops.length) {
|
|
129
|
-
const op = ops[probe]
|
|
130
|
-
if (op.kind !== ' ') { collected.push(op); probe++; continue }
|
|
131
|
-
const rest = ops.slice(probe, probe + CONTEXT * 2 + 1)
|
|
132
|
-
if (rest.some((item) => item.kind !== ' ')) { collected.push(op); probe++; continue }
|
|
133
|
-
break
|
|
134
|
-
}
|
|
135
|
-
const tail = ops.slice(probe, probe + CONTEXT)
|
|
136
|
-
const oldStartLine = oldLine - head.length + 1
|
|
137
|
-
const newStartLine = newLine - head.length + 1
|
|
138
|
-
hunks.push(makeHunk([...head, ...collected, ...tail], oldStartLine, newStartLine))
|
|
139
|
-
for (const op of collected) {
|
|
140
|
-
if (op.kind !== '+') oldLine++
|
|
141
|
-
if (op.kind !== '-') newLine++
|
|
142
|
-
}
|
|
143
|
-
oldLine += head.length + tail.length
|
|
144
|
-
newLine += head.length + tail.length
|
|
145
|
-
index = probe + tail.length
|
|
146
|
-
}
|
|
147
|
-
return hunks
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* @author ddj 2026年10月29号
|
|
152
|
-
* @description: 由一段操作装配 hunk。
|
|
153
|
-
* @param ops 该 hunk 的操作
|
|
154
|
-
* @param oldStart 基线起始行
|
|
155
|
-
* @param newStart 当前起始行
|
|
156
|
-
* @returns hunk
|
|
157
|
-
*/
|
|
158
|
-
function makeHunk(ops: LineOp[], oldStart: number, newStart: number): ReviewHunk {
|
|
159
|
-
const oldCount = ops.filter((op) => op.kind !== '+').length
|
|
160
|
-
const newCount = ops.filter((op) => op.kind !== '-').length
|
|
161
|
-
return { oldStart, oldLines: oldCount, newStart, newLines: newCount, lines: ops.map((op) => op.kind + op.text) }
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* @author ddj 2026年10月29号
|
|
166
|
-
* @description: 行级差异:先剪公共前后缀,剩余部分在限额内做 LCS,超限按整段替换。
|
|
167
|
-
* @param oldLines 基线行
|
|
168
|
-
* @param newLines 当前行
|
|
169
|
-
* @returns 顺序完整的操作列表
|
|
170
|
-
*/
|
|
171
|
-
function diffLines(oldLines: string[], newLines: string[]): LineOp[] {
|
|
172
|
-
let head = 0
|
|
173
|
-
while (head < oldLines.length && head < newLines.length && oldLines[head] === newLines[head]) head++
|
|
174
|
-
let tail = 0
|
|
175
|
-
while (tail < oldLines.length - head && tail < newLines.length - head
|
|
176
|
-
&& oldLines[oldLines.length - 1 - tail] === newLines[newLines.length - 1 - tail]) tail++
|
|
177
|
-
const left = oldLines.slice(head, oldLines.length - tail)
|
|
178
|
-
const right = newLines.slice(head, newLines.length - tail)
|
|
179
|
-
const middle = left.length * right.length > CELL_LIMIT ? coarseOps(left, right) : lcsOps(left, right)
|
|
180
|
-
return [
|
|
181
|
-
...oldLines.slice(0, head).map((text) => ({ kind: ' ' as const, text })),
|
|
182
|
-
...middle,
|
|
183
|
-
...oldLines.slice(oldLines.length - tail).map((text) => ({ kind: ' ' as const, text })),
|
|
184
|
-
]
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* @author ddj 2026年10月29号
|
|
189
|
-
* @description: 超限时的退化口径:整段删除再整段新增,绝不谎报逐行对应。
|
|
190
|
-
* @param left 基线剩余行
|
|
191
|
-
* @param right 当前剩余行
|
|
192
|
-
* @returns 操作列表
|
|
193
|
-
*/
|
|
194
|
-
function coarseOps(left: string[], right: string[]): LineOp[] {
|
|
195
|
-
return [
|
|
196
|
-
...left.map((text) => ({ kind: '-' as const, text })),
|
|
197
|
-
...right.map((text) => ({ kind: '+' as const, text })),
|
|
198
|
-
]
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* @author ddj 2026年10月29号
|
|
203
|
-
* @description: 限额内的 LCS 行差异。
|
|
204
|
-
* @param left 基线剩余行
|
|
205
|
-
* @param right 当前剩余行
|
|
206
|
-
* @returns 操作列表
|
|
207
|
-
*/
|
|
208
|
-
function lcsOps(left: string[], right: string[]): LineOp[] {
|
|
209
|
-
const rows = left.length + 1
|
|
210
|
-
const cols = right.length + 1
|
|
211
|
-
const table = new Uint32Array(rows * cols)
|
|
212
|
-
for (let i = left.length - 1; i >= 0; i--) {
|
|
213
|
-
for (let j = right.length - 1; j >= 0; j--) {
|
|
214
|
-
table[i * cols + j] = left[i] === right[j]
|
|
215
|
-
? table[(i + 1) * cols + j + 1] + 1
|
|
216
|
-
: Math.max(table[(i + 1) * cols + j], table[i * cols + j + 1])
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
const ops: LineOp[] = []
|
|
220
|
-
let i = 0
|
|
221
|
-
let j = 0
|
|
222
|
-
while (i < left.length && j < right.length) {
|
|
223
|
-
if (left[i] === right[j]) { ops.push({ kind: ' ', text: left[i] }); i++; j++; continue }
|
|
224
|
-
if (table[(i + 1) * cols + j] >= table[i * cols + j + 1]) { ops.push({ kind: '-', text: left[i] }); i++ }
|
|
225
|
-
else { ops.push({ kind: '+', text: right[j] }); j++ }
|
|
226
|
-
}
|
|
227
|
-
while (i < left.length) ops.push({ kind: '-', text: left[i++] })
|
|
228
|
-
while (j < right.length) ops.push({ kind: '+', text: right[j++] })
|
|
229
|
-
return ops
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
/**
|
|
233
|
-
* @author ddj 2026年10月29号
|
|
234
|
-
* @description: 判断这次差异是否触发了大文件退化口径。
|
|
235
|
-
* @param oldText 基线全文
|
|
236
|
-
* @param newText 当前全文
|
|
237
|
-
* @returns 是否粗粒度
|
|
238
|
-
*/
|
|
239
|
-
function isCoarse(oldText: string, newText: string): boolean {
|
|
240
|
-
return logicalLines(oldText).length * logicalLines(newText).length > CELL_LIMIT
|
|
241
|
-
}
|