дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-04 01:01:17 +02:00
A search field above the Agents task list (and the session history popup) filters tasks as you type: fuzzy on the title with the matches highlighted, word starts on the project folder and branch. It searches every section, collapsed Archived included, hides sections without a match; Up/Down move the selection, Enter opens, Escape clears.
15 рядки
735 B
TypeScript
15 рядки
735 B
TypeScript
/** Filtering the Agents task list: fuzzy on the title (highlighted), word starts on the project folder and branch. */
|
|
import type { AgentTask } from "@/bindings";
|
|
import { fuzzyMatch, wordMatch } from "@/ui";
|
|
import { basename } from "@/platform/project";
|
|
|
|
/** Indices of `query` in the task's title to highlight ([] when another field matched), or null when it doesn't match. */
|
|
export function matchTask(task: AgentTask, query: string): number[] | null {
|
|
const q = query.trim();
|
|
if (!q) return [];
|
|
const title = fuzzyMatch(task.title, q);
|
|
if (title) return title;
|
|
const others = [task.projectRoot ? basename(task.projectRoot) : null, task.branch];
|
|
return others.some((text) => text && wordMatch(text, q)) ? [] : null;
|
|
}
|