Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

docs(cli): say when a part-name match can outrank a named entry (#7726)

Joey7ae39ea46fef
diff --git a/.changeset/search-compound-names.md b/.changeset/search-compound-names.md
index 56ae8e815d..a2a6668852 100644
--- a/.changeset/search-compound-names.md
+++ b/.changeset/search-compound-names.md
@@ -9,7 +9,7 @@
- Adjacent query words that join into a component, hook, or template name, or into a one-word keyword, match it: `table header cell with sort arrow` finds `TableHeaderCell`, `tree view folders` the `treeview` keyword, and a hook answers to its words without `use`. Most of a name, a name's leading words, or a run of its words also count for components and hooks, a step below the full name.
- A query that is one camelCase identifier and matches nothing as typed is read as the words it spells, so an unknown API name such as `useTablePaginationState` reaches `useTablePagination`. In a query of several words each identifier stays one term.
-- When the whole query is an entry's name, these readings add no near siblings beside it. A match on part of another name or on a joined keyword never ranks above an entry the query names.
+- When the whole query is an entry's name, these readings add no near siblings beside it. A match on a joined keyword never ranks above an entry the query names, and a match on part of another name does only when it spans more query words than that entry's name.
- A gerund matches its verb (`spacing` and `space`, `dragging` and `drag`), and a plural can start a longer word through its singular (`tokens` and `Tokenizer`).
- Core component docs declare more keywords: other libraries' names (`scrollarea`, `togglegroup`, `pageheader`, `splitpane`, `circularprogress`, `linearprogress`, `commandmenu`, `relativetime`, `sidesheet`, `descriptionlist`, `inlinecode`) and common glyph names on `Icon`, since any icon library's glyph renders through it.
- The JSON shape is unchanged.
diff --git a/packages/cli/api/search/search.mjs b/packages/cli/api/search/search.mjs
index 6a4a1cb64c..820f1f8e77 100644
--- a/packages/cli/api/search/search.mjs
+++ b/packages/cli/api/search/search.mjs
@@ -2381,8 +2381,9 @@ async function searchOnce(query, options) {
word: wordNamed(candidate),
});
}
- // A match through part of a name or a keyword read joined never outranks
- // an entry the query names: `table header with sticky columns` keeps
+ // A match on a keyword read joined never outranks an entry the query names,
+ // and neither does a match on part of another name unless it spans more
+ // query words than any named run: `table header with sticky columns` keeps
// TableHeader above useTableStickyColumns, which only holds the words
// `sticky columns`. Only the order changes; each result keeps the score its
// text earned.