dsh-vscode-mode 0.19.1 → 0.19.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 +6 -4
- package/lib/client.js +32 -2
- package/lib/client.js.map +1 -1
- package/package.json +1 -1
- package/src/client/sidebar/panels/FileExplorer.ts +34 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-vscode-mode",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.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": [
|
|
@@ -35,6 +35,8 @@ const PREFETCH_MAX = 4
|
|
|
35
35
|
const PREFETCH_EXCLUDED = new Set(['node_modules', '.git', '.hg', '.svn', '.pnpm', '.pnpm-store'])
|
|
36
36
|
/** 外部文件变化重列去抖:一轮外部批量写入(如 agent 连写多文件)合并为一次重列。 */
|
|
37
37
|
const FILE_CHANGE_DEBOUNCE_MS = 400
|
|
38
|
+
/** 兼容 host 返回裸文案或附带路径的缺失目录错误。 */
|
|
39
|
+
const MISSING_DIR_PREFIX = '目录不存在'
|
|
38
40
|
|
|
39
41
|
// --region 行图标(官方原语:目录文件夹图标 + 文件类型图标;缺失时回落纯文本)
|
|
40
42
|
|
|
@@ -135,6 +137,24 @@ export function FileExplorer(props) {
|
|
|
135
137
|
/** 渲染取数:内存态 → 本地条目缓存 → null(显示加载态)。 */
|
|
136
138
|
const entriesOf = (rel) => dirsRef.current[rel] ?? entriesCacheGet(scope, rel) ?? null
|
|
137
139
|
|
|
140
|
+
/**
|
|
141
|
+
* @private
|
|
142
|
+
* @author ddj 2026年10月23号
|
|
143
|
+
* @description 移除已删除目录的展开记录,经现有防抖持久化自愈;不改请求 token,保留 finally 的加载态清理。
|
|
144
|
+
* @param rel 已确认缺失的非根相对目录
|
|
145
|
+
*/
|
|
146
|
+
function dropDeadDir(rel) {
|
|
147
|
+
setExpanded(removeExpansion)
|
|
148
|
+
|
|
149
|
+
/** @private @author ddj 2026年10月23号 @param prev 当前展开映射。 @returns 移除失效目录后的展开映射。 */
|
|
150
|
+
function removeExpansion(prev) {
|
|
151
|
+
if (prev[rel] !== true) return prev
|
|
152
|
+
const next = Object.assign({}, prev)
|
|
153
|
+
delete next[rel]
|
|
154
|
+
return next
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
138
158
|
/** 预取子目录:≤4 个、排除重型目录、缓存新鲜跳过、已加载跳过、不级联。 */
|
|
139
159
|
const prefetchDirs = (rel, entries) => {
|
|
140
160
|
const want = []
|
|
@@ -176,11 +196,14 @@ export function FileExplorer(props) {
|
|
|
176
196
|
if (res.root) setRoot((prev) => prev || res.root)
|
|
177
197
|
entriesCachePut(scope, rel, res.entries)
|
|
178
198
|
if (doPrefetch) prefetchDirs(rel, res.entries)
|
|
179
|
-
} else {
|
|
180
|
-
//
|
|
181
|
-
|
|
182
|
-
|
|
199
|
+
} else if (!entriesOf(rel)) {
|
|
200
|
+
// 保留有缓存时的 SWR 降级;仅缺失的子目录自愈,根目录错误必须继续展示。
|
|
201
|
+
const message = res?.error ? String(res.error) : '读取目录失败'
|
|
202
|
+
if (rel && message.startsWith(MISSING_DIR_PREFIX)) {
|
|
203
|
+
dropDeadDir(rel)
|
|
204
|
+
return
|
|
183
205
|
}
|
|
206
|
+
setErrors((prev) => Object.assign({}, prev, { [rel]: message }))
|
|
184
207
|
}
|
|
185
208
|
}).catch((e) => {
|
|
186
209
|
if (scopeRef.current !== scope || tokensRef.current !== tokens || tokens[rel] !== token) return
|
|
@@ -475,7 +498,13 @@ export function FileExplorer(props) {
|
|
|
475
498
|
|
|
476
499
|
const errorList = Object.entries(errors)
|
|
477
500
|
// 跨端会话缺失:裸错误替换为友好标题 + 详情(重试仍保留,会话在本端可用后即恢复)
|
|
478
|
-
|
|
501
|
+
let rawErrorText = null
|
|
502
|
+
if (errorList.length) {
|
|
503
|
+
const [errorRel, message] = errorList[0]
|
|
504
|
+
rawErrorText = message
|
|
505
|
+
// 路径只在展示层追加,RPC 业务错误与异常均可定位;兼容已带路径的 host。
|
|
506
|
+
if (errorRel && !message.endsWith(':' + errorRel)) rawErrorText += ':' + errorRel
|
|
507
|
+
}
|
|
479
508
|
const sessionMissing = isSessionMissingError(rawErrorText)
|
|
480
509
|
const errorText = rawErrorText === null
|
|
481
510
|
? null
|