dsh-vscode-mode 0.15.7 → 0.15.8
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 +3 -2
- package/lib/client.js +65 -1
- package/lib/client.js.map +1 -1
- package/lib/index.js +15 -6
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/client/sessionError.ts +38 -0
- package/src/client/sidebar/panels/FileExplorer.ts +7 -1
- package/src/client/ui/EditorView.ts +13 -0
- package/src/lsp/rpc.ts +3 -2
- package/src/rpc.ts +3 -3
- package/src/shared/rpc.ts +11 -0
- package/src/svn.ts +3 -2
package/lib/index.js
CHANGED
|
@@ -2423,6 +2423,15 @@ function imageMimeOf(path) {
|
|
|
2423
2423
|
/** PDF 统一 MIME(host base64 响应与 client PDF 面板同源,避免两处漂移)。 */
|
|
2424
2424
|
const PDF_MIME = "application/pdf";
|
|
2425
2425
|
/**
|
|
2426
|
+
* 会话级前置错误的规范文案:host requireSession 系与 client 错误识别共用同一常量,
|
|
2427
|
+
* 避免文案漂移导致 client 端分类失效。跨端场景(桌面端/Web 端各自运行独立 DSH 实例、
|
|
2428
|
+
* 会话列表互通但会话仅在一端激活)下,本端 host 取不到会话即返回「会话不存在」。
|
|
2429
|
+
* @author ddj 2026年10月16号
|
|
2430
|
+
*/
|
|
2431
|
+
const SESSION_MISSING_ERROR = "会话不存在";
|
|
2432
|
+
/** 会话存在但无工作区 cwd 时的规范文案(与 SESSION_MISSING_ERROR 同源共用)。 */
|
|
2433
|
+
const SESSION_NO_WORKSPACE_ERROR = "会话无工作区";
|
|
2434
|
+
/**
|
|
2426
2435
|
* 路径 → 二进制预览 MIME:PDF 特判 {@link PDF_MIME},其余走图片表回退 octet-stream。
|
|
2427
2436
|
* @author ddj 2026年09月22号
|
|
2428
2437
|
* @param path 文件路径(`/` 或 `\` 分隔均可)
|
|
@@ -11198,9 +11207,9 @@ function recView(record, ws = null) {
|
|
|
11198
11207
|
/** 会话/工作区公共前置:返回 {session,cwd} 或错误文案。 */
|
|
11199
11208
|
async function requireSession(ctx, sessionId) {
|
|
11200
11209
|
const session = sessionOf(ctx, sessionId);
|
|
11201
|
-
if (!session) return { err:
|
|
11210
|
+
if (!session) return { err: SESSION_MISSING_ERROR };
|
|
11202
11211
|
const cwd = cwdOf(session);
|
|
11203
|
-
if (!cwd) return { err:
|
|
11212
|
+
if (!cwd) return { err: SESSION_NO_WORKSPACE_ERROR };
|
|
11204
11213
|
return {
|
|
11205
11214
|
session,
|
|
11206
11215
|
cwd
|
|
@@ -16706,8 +16715,8 @@ function createLspRpc(deps) {
|
|
|
16706
16715
|
/** 解析会话与工作区根(失败 → null + error)。 */
|
|
16707
16716
|
const rootOf = async (sessionId) => {
|
|
16708
16717
|
const session = sessionOf(ctx, sessionId);
|
|
16709
|
-
if (!session) return { err:
|
|
16710
|
-
if (!cwdOf(session)) return { err:
|
|
16718
|
+
if (!session) return { err: SESSION_MISSING_ERROR };
|
|
16719
|
+
if (!cwdOf(session)) return { err: SESSION_NO_WORKSPACE_ERROR };
|
|
16711
16720
|
try {
|
|
16712
16721
|
return {
|
|
16713
16722
|
root: await searchRoot(ctx, session),
|
|
@@ -19960,9 +19969,9 @@ function foregroundHelperArgv(processName) {
|
|
|
19960
19969
|
/** host 会话/工作区前置(对齐 rpc.ts requireSession 的错误文案)。 */
|
|
19961
19970
|
async function requireSvnSession(ctx, sessionId) {
|
|
19962
19971
|
const session = sessionOf(ctx, sessionId);
|
|
19963
|
-
if (!session) return { err:
|
|
19972
|
+
if (!session) return { err: SESSION_MISSING_ERROR };
|
|
19964
19973
|
const cwd = cwdOf(session);
|
|
19965
|
-
if (!cwd) return { err:
|
|
19974
|
+
if (!cwd) return { err: SESSION_NO_WORKSPACE_ERROR };
|
|
19966
19975
|
return { cwd };
|
|
19967
19976
|
}
|
|
19968
19977
|
/** 工作区相对路径归一('' 合法 = 工作区根;非法含越界/绝对路径返回 null)。 */
|