feat(tsl-api-reference): improve tagged API discovery

This commit is contained in:
csh
2026-07-31 12:37:59 +08:00
parent 736d1a8ad7
commit 29d110110b
5 changed files with 136 additions and 67 deletions
+15 -6
View File
@@ -29,12 +29,21 @@ description: "当编写、修改或审查 TSL 代码时需要确认 builtin、do
- 未知名称,但知道其行为或中文关键词:
```bash
python <this-skill-dir>/scripts/lookup.py --kw 数组 排序
python <this-skill-dir>/scripts/lookup.py --kw 最大值 位置
```
- 关键词采用 AND 语义;增加关键词可缩小结果范围。
- 关键词会搜索原有字段及 `qualified_name`、`owner`、`kind`、`binding`、
`visibility`;因此可用 `--kw protected method` 等组合缩小成员范围。
- 只查询一个 scope
```bash
python <this-skill-dir>/scripts/lookup.py --scope builtin --name boolToStr
python <this-skill-dir>/scripts/lookup.py --scope dotnet --kw argmax
```
- 关键词采用字面 AND 语义;增加关键词可缩小结果范围。常用同义词由 API 条目的
Tags 提供,例如“位置/下标”“列表/数组”“打印/输出”。
- 关键词会搜索 `name`、`signature`、`tags`、`summary`、`module`、`scope` 及
`qualified_name`、`owner`、`kind`、`binding`、`visibility`,并按字段加权稳定排序;
因此也可用 `--kw dotnet argmax` 或 `--kw protected method` 缩小范围。
- 使用 `--limit N` 调整打印的候选行数量,N 必须 >= 1。
精确查询会打印完整的条目正文和来源标记。关键词查询打印候选行;
@@ -52,8 +61,8 @@ method 显示 `function`,类方法显示 `class function`,静态字段与常
`static field`、`static const`。
同名 API 存在于多个 scope 或模块时(如 `host`、`login`、`port`),`--name`
会依次打印全部同名条目,每条带自己的来源标记。按当前代码所处的 scope 和模块
选择条目,不要默认取第一条。
会依次打印全部同名条目,每条带自己的来源标记。已知 scope 时先用 `--scope`
过滤;否则按当前代码所处的 scope 和模块选择条目,不要默认取第一条。
查询脚本兼容旧 8 列和新 13 列 `function_index.tsv`。旧 8 列索引仍可查询原有
function;完全限定名称、owner、kind、binding、visibility 依赖新索引中的扩展列。