mirror of
https://github.com/jparkerweb/plan2code.git
synced 2026-11-17 04:45:33 -08:00
Sync upstream web console updates into v2.4.2: on-demand Cleanup of unused ~/.plan2code files, an UPDATE AVAILABLE banner from the release tags, a colored launcher with a Planny banner, Notes threads that keep the person's notes and read older reply shapes, the repo-local plan2code-model-update maintainer skill, and review fixes (413 for oversize bodies, notes kept on skip, scoped reconnect banner, live Overview tab, busy state on 409, menu keyboard focus, case-insensitive mentions)
This commit is contained in:
1 parent
f968aeded8
commit
c19a072a3a
165 files changed
+13025
-1234
No files matched your search
@@ -5,7 +5,10 @@
|
||||
// popover; this file owns the rules. No DOM access at module scope and no
|
||||
// imports: the page and `node --test` both import this file.
|
||||
|
||||
const NAME_CHAR = /[a-z0-9-]/;
|
||||
// Uppercase too: "@Repo" must still name @repo — names are forced lowercase
|
||||
// by the workspace rules, and a query typed with a capital otherwise matches
|
||||
// nothing and opens no suggestions at all.
|
||||
const NAME_CHAR = /[a-z0-9-]/i;
|
||||
const MAX_MATCHES = 6;
|
||||
|
||||
/**
|
||||
@@ -23,11 +26,13 @@ export function mentionAt(text, caret) {
|
||||
}
|
||||
|
||||
// Names starting with the query first, then names containing it, in the
|
||||
// order given, at most six.
|
||||
// order given, at most six. Case-folded: folder names are lowercase by rule,
|
||||
// and "@Repo" should still find @repo rather than claim nothing matches.
|
||||
export function matchNames(names, query) {
|
||||
const q = String(query || "");
|
||||
const prefix = names.filter((n) => n.startsWith(q));
|
||||
const inside = names.filter((n) => !n.startsWith(q) && n.includes(q));
|
||||
const q = String(query || "").toLowerCase();
|
||||
const fold = (n) => String(n).toLowerCase();
|
||||
const prefix = names.filter((n) => fold(n).startsWith(q));
|
||||
const inside = names.filter((n) => !fold(n).startsWith(q) && fold(n).includes(q));
|
||||
return [...prefix, ...inside].slice(0, MAX_MATCHES);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user