@zephyrdeng/pi-review 0.6.1 → 0.6.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.
|
@@ -177,6 +177,21 @@ describe("buildRvCompletions", () => {
|
|
|
177
177
|
assert.ok(tmpl.value.endsWith(" @"));
|
|
178
178
|
});
|
|
179
179
|
|
|
180
|
+
it("does not duplicate list-models completion at top level", () => {
|
|
181
|
+
for (const locale of ["en", "zh"] as const) {
|
|
182
|
+
for (const prefix of ["", "models", "list", "mod"]) {
|
|
183
|
+
const items = buildRvCompletions(prefix, { ...deps, locale });
|
|
184
|
+
if (!items?.length) continue;
|
|
185
|
+
const ui = rvUi(locale);
|
|
186
|
+
const listModelItems = items.filter((i) => i.label === ui.listModels);
|
|
187
|
+
assert.ok(
|
|
188
|
+
listModelItems.length <= 1,
|
|
189
|
+
`locale=${locale} prefix=${JSON.stringify(prefix)} got ${listModelItems.length} "${ui.listModels}" items`,
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
|
|
180
195
|
it("every returned value preserves the head prefix (整段替换安全)", () => {
|
|
181
196
|
const cases = ["@a.ts --mode ", "@a.ts --model ", "@a.ts --thinking ", "@a.ts --"];
|
|
182
197
|
for (const c of cases) {
|
|
@@ -424,7 +424,13 @@ function topLevelCompletions(
|
|
|
424
424
|
items.push(...semanticCompletionItems(localeOf(deps), tail, headPrefix, head));
|
|
425
425
|
|
|
426
426
|
const ui = rvUi(localeOf(deps));
|
|
427
|
-
|
|
427
|
+
const hasListModelsItem = items.some((i) => i.label === ui.listModels);
|
|
428
|
+
if (
|
|
429
|
+
!hasListModelsItem &&
|
|
430
|
+
(fuzzyMatch(ui.modelsKeyword, tail) ||
|
|
431
|
+
ui.modelsKeyword.startsWith(tail) ||
|
|
432
|
+
fuzzyMatch("models", tail))
|
|
433
|
+
) {
|
|
428
434
|
items.push({
|
|
429
435
|
value: `${headPrefix}${ui.listModels}`,
|
|
430
436
|
label: ui.listModels,
|