search: browse bounded recent items with kind-only queries

This commit is contained in:
2026-10-20 17:54:00 +01:00
parent cce7ea903a
commit 9cdfd9d9ab
12 changed files with 477 additions and 94 deletions
+9 -8
View File
@@ -61,7 +61,6 @@ export function parseSearchQuery(value, selectedKind = DEFAULT_SEARCH_KIND) {
return { query, kind, hasType };
}
export const SEARCH_TYPE_HELP = "Add search text after the type filter (for example, t:pipeline plan). This server does not list results by type alone.";
/**
* The orders the search sort control offers. "Relevance" keeps the server's own
@@ -337,19 +336,21 @@ export function searchPanelEmptyMessage(state, shown, kind) {
if ((shown ?? []).length > 0) return null;
if (state?.loading) return null;
const query = String(state?.query ?? "");
if (query.trim() === "") return null;
if (query.trim() === "") {
if (!state?.loaded || !kind) return null;
const label = searchKindLabel(kind).toLowerCase();
return state?.truncated ? `No ${label} found within the server's scan limit.` : `No ${label} yet.`;
}
if (kind === "" || kind == null) return `No matches for "${query}".`;
return `No ${searchKindLabel(kind).toLowerCase()} match "${query}".`;
}
/**
* Whether a keystroke's text is worth asking the server about. A blank or
* whitespace-only query is cleared locally and never sent, so the server is not
* asked to scan for nothing. The one predicate the field's input handler and its
* immediate-send path share.
* Text searches and valid kind-only browsing are sendable. Empty text with no
* supported kind still clears locally, without an all-kind scan.
*/
export function searchQuerySendable(query) {
return String(query ?? "").trim() !== "";
export function searchQuerySendable(query, kind = "") {
return String(query ?? "").trim() !== "" || SEARCH_KINDS.some((option) => option.value !== "" && option.value === kind);
}
/**