dsh-vscode-mode 0.14.1 → 0.14.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 CHANGED
@@ -451,24 +451,24 @@ DSH 每次启动监听随机端口,`http://127.0.0.1:<port>` 就是浏览器 o
451
451
 
452
452
  官方 `dsh plugin` 方式,三选一。下面以 `web` profile 为例;Desktop 或其他命名
453
453
  profile 请替换为实际目标,不要把示例目录当成当前运行 profile。升级前可阅读
454
- [0.14.1 适配与发布说明](docs/release-0.14.1.md)。
454
+ [0.14.2 发布说明](docs/release-0.14.2.md)与 [0.14.1 适配说明](docs/release-0.14.1.md)。
455
455
 
456
456
  ```bash
457
457
  # ① Git 安装(clone + prepare 构建;推荐打固定 tag)
458
- dsh plugin --profile web add github:Lenonss/DSH_VsCodeMode#v0.14.1
458
+ dsh plugin --profile web add github:Lenonss/DSH_VsCodeMode#v0.14.2
459
459
 
460
460
  # ② npm 注册表(发布到 npm 后)
461
- dsh plugin --profile web add dsh-vscode-mode@0.14.1
461
+ dsh plugin --profile web add dsh-vscode-mode@0.14.2
462
462
 
463
463
  # ③ GitHub Release tgz 直装(Release asset 可用后)
464
- dsh plugin --profile web add https://github.com/Lenonss/DSH_VsCodeMode/releases/download/v0.14.1/dsh-vscode-mode-0.14.1.tgz
464
+ dsh plugin --profile web add https://github.com/Lenonss/DSH_VsCodeMode/releases/download/v0.14.2/dsh-vscode-mode-0.14.2.tgz
465
465
  ```
466
466
 
467
- > **DSH 0.2.0-rc.1 安装修复**:`0.14.1` 仅精确放行此 DSH 版本;旧版
468
- > `0.14.0` 仍会被其 peer 门禁拒绝,其他 0.2 版本须另行适配。Tag 推送后需等
469
- > GitHub Actions 发布完成,npm 还须确认该版本可查询;在产物未就绪时,可依
470
- > [0.14.1 适配与发布说明](docs/release-0.14.1.md) 构建并安装本地包。若添加 bundle 后尚未激活,
471
- > 在方便时重启目标 DSH Host 并刷新原页面(本次 Web profile 已即时挂载)。
467
+ > **DSH 0.2.0-rc.1 安装修复**:`0.14.1` 起仅精确放行此 DSH 版本;旧版
468
+ > `0.14.0` 仍会被其 peer 门禁拒绝,其他 0.2 版本须另行适配。`0.14.2` 增加
469
+ > 全局搜索修复;npm 安装前应确认注册表中版本可查询,产物未就绪时可依
470
+ > [0.14.2 发布说明](docs/release-0.14.2.md) 构建并安装本地包。替换已有包后需
471
+ > 重启目标 DSH Host 并刷新原页面,才能加载新的后端搜索实现。
472
472
  >
473
473
  > `dsh plugin ...` 是 pnpm 转发器:git 安装会克隆仓库、执行该包 `prepare` 脚本
474
474
  > (tsdown 双面构建)后安装,再按 `dsh.bundle` 声明自动加入 profile 的 bundles
@@ -797,6 +797,7 @@ Keep All / Undo All 却是亮的。修复:单文件 Keep / Undo 覆盖冲突
797
797
  完整变更见 [GitHub Releases](https://github.com/Lenonss/DSH_VsCodeMode/releases)。
798
798
  近期关键版本:
799
799
 
800
+ - **v0.14.2**:**全局搜索选项行为修复**——未勾选「区分大小写」时显式使用内容搜索 `--ignore-case`,大写查询仍命中小写内容,不改变文件 glob 的大小写规则;「仅当前文件」无活动文件时不再误搜整个工作区,切换活动文件时自动重搜。大小写、全词、正则与包含/排除开关补充定向测试;详见 [0.14.2 发布说明](docs/release-0.14.2.md)。
800
801
  - **v0.14.1**:**DSH Web 0.2.0-rc.1 安装兼容**——六项 DSH peer 精确加入
801
802
  `=0.2.0-rc.1`,保留已有 0.1.x 范围,继续拒绝其他未经适配的 0.2 版本;
802
803
  版本线报告单列 rc.1。已完成 Web 安装、挂载与编辑器基础冒烟,完整功能和
package/lib/client.js CHANGED
@@ -28862,6 +28862,18 @@ window.__ModuleLoader__.load({
28862
28862
  return String(text ?? "").split(",").map((item) => item.trim()).filter(Boolean);
28863
28863
  }
28864
28864
  /**
28865
+ * 计算包含文件范围;仅当前文件已开启但无活动文件时返回 null,禁止退化为全工作区搜索。
28866
+ * @author ddj 2026年09月29号
28867
+ * @param onlyActive 是否仅搜索当前文件
28868
+ * @param activePath 当前文件路径
28869
+ * @param includeText 用户输入的包含模式
28870
+ * @returns 包含 glob;null 表示当前搜索范围不可用
28871
+ */
28872
+ function searchIncludes(onlyActive, activePath, includeText) {
28873
+ if (!onlyActive) return splitGlobs(includeText);
28874
+ return activePath ? [activePath] : null;
28875
+ }
28876
+ /**
28865
28877
  * 读取按作用域持久化的搜索条件(损坏/缺失返回 null)。
28866
28878
  * 抽成函数而非内联:恢复 effect 内有两处消费者(填状态、同步 requestRef),
28867
28879
  * 且解析必须只做一次(JSON.parse 重复调用既慢又可能两次结果不一致)。
@@ -28936,7 +28948,7 @@ window.__ModuleLoader__.load({
28936
28948
  matchCase,
28937
28949
  wholeWord,
28938
28950
  regex,
28939
- include: onlyActive ? activePath ? [activePath] : [] : splitGlobs(includeText),
28951
+ include: searchIncludes(onlyActive, activePath, includeText),
28940
28952
  exclude: excludeOn ? splitGlobs(excludeText) : []
28941
28953
  };
28942
28954
  react.default.useEffect(() => {
@@ -28956,7 +28968,7 @@ window.__ModuleLoader__.load({
28956
28968
  matchCase: saved.matchCase === true,
28957
28969
  wholeWord: saved.wholeWord === true,
28958
28970
  regex: saved.regex === true,
28959
- include: saved.onlyActive === true ? activePathRef.current ? [activePathRef.current] : [] : splitGlobs(typeof saved.includeText === "string" ? saved.includeText : ""),
28971
+ include: searchIncludes(saved.onlyActive === true, activePathRef.current, typeof saved.includeText === "string" ? saved.includeText : ""),
28960
28972
  exclude: saved.excludeOn === true ? splitGlobs(typeof saved.excludeText === "string" ? saved.excludeText : "") : []
28961
28973
  };
28962
28974
  }
@@ -29001,6 +29013,14 @@ window.__ModuleLoader__.load({
29001
29013
  return;
29002
29014
  }
29003
29015
  const req = requestRef.current;
29016
+ if (req.include === null) {
29017
+ setMatches([]);
29018
+ setTruncated(false);
29019
+ setError("");
29020
+ setWarning("");
29021
+ setStatus("done");
29022
+ return;
29023
+ }
29004
29024
  setStatus("searching");
29005
29025
  setError("");
29006
29026
  setWarning("");
@@ -29051,13 +29071,13 @@ window.__ModuleLoader__.load({
29051
29071
  timerRef.current = setTimeout(() => runSearch(queryRef.current), DEBOUNCE_MS);
29052
29072
  };
29053
29073
  /**
29054
- * 立即重搜(查询 ≥2 字符时);先同步 ref 避免本次调用读到旧请求参数。
29074
+ * 立即刷新搜索(短查询清空旧结果);先同步 ref 避免本次调用读到旧请求参数。
29055
29075
  * @param next 新的请求参数字段
29056
29076
  */
29057
29077
  const rerun = (next) => {
29058
29078
  requestRef.current = Object.assign({}, requestRef.current, next);
29059
29079
  if (timerRef.current) clearTimeout(timerRef.current);
29060
- if (String(queryRef.current).trim().length >= 2) runSearch(queryRef.current);
29080
+ runSearch(queryRef.current);
29061
29081
  };
29062
29082
  /** 选项开关切换(大小写/全词/正则/书本/设置):更新状态 + 立即重搜。 */
29063
29083
  const toggleOpt = (key, value) => {
@@ -29078,10 +29098,16 @@ window.__ModuleLoader__.load({
29078
29098
  matchCase: base.matchCase,
29079
29099
  wholeWord: base.wholeWord,
29080
29100
  regex: base.regex,
29081
- include: base.onlyActive ? activePathRef.current ? [activePathRef.current] : [] : splitGlobs(includeText),
29101
+ include: searchIncludes(base.onlyActive, activePathRef.current, includeText),
29082
29102
  exclude: base.excludeOn ? splitGlobs(excludeText) : []
29083
29103
  });
29084
29104
  };
29105
+ const previousPathRef = react.default.useRef(activePath);
29106
+ react.default.useEffect(() => {
29107
+ if (previousPathRef.current === activePath) return;
29108
+ previousPathRef.current = activePath;
29109
+ if (onlyActive) rerun({ include: searchIncludes(true, activePath, includeText) });
29110
+ }, [activePath]);
29085
29111
  /**
29086
29112
  * 取用一次性选区种子(需求 1:Ctrl+Shift+F 时把编辑器选中文本填入搜索框)。
29087
29113
  * 有种子即填入并立即搜索(不再等 250ms 防抖),同时全选便于直接改写;无种子为 no-op。
@@ -29180,9 +29206,9 @@ window.__ModuleLoader__.load({
29180
29206
  onChange: (e) => onChangeDebounced(setIncludeText, e.target.value)
29181
29207
  }), react.default.createElement("button", {
29182
29208
  className: "edrv-search-toggle" + (onlyActive ? " on" : ""),
29183
- title: activePath ? "仅在当前打开的文件中搜索" : "无打开的文件(需先打开文件)",
29209
+ title: activePath ? "仅在当前打开的文件中搜索" : onlyActive ? "无打开的文件(点击退出仅当前文件)" : "无打开的文件(需先打开文件)",
29184
29210
  "aria-pressed": onlyActive,
29185
- disabled: !activePath,
29211
+ disabled: !activePath && !onlyActive,
29186
29212
  onClick: () => toggleOpt("onlyActive", !onlyActive)
29187
29213
  }, "📖")), react.default.createElement("div", { className: "edrv-search-row" }, react.default.createElement("input", {
29188
29214
  className: "edrv-search-field" + (excludeOn ? "" : " dim"),