You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Design keyboard-layout tolerant search with a matcher-independent core #1
Recover searches typed with the wrong keyboard layout, preserving the existing matchers.
Implementation: #2. Example: уну must find the same EyeAuras projects and thread metadata as eye.
Our own TypeScript implementation; no JetBrains code port or language-specific fallback tables.
Web/desktop learn physical-key → character pairs, including digits, punctuation and Shift.
Folder browsing and the web/desktop command palette use the same learned variants.
Palette readings run independently, then merge without duplicates. Existing groups, secondary rows, limits, message sections and typed-query history are preserved.
Unknown input stays literal. Learned pairs last for the page session and also work for pasted text.
Other selectors, native mobile key capture and server-selected message/content/file searches remain follow-ups.
First research pass: matcher behavior and T3 integration
Reference revisions: T3 6575ce32508bd7908444241f3719aa33aaf77f90; JetBrains IntelliJ Community 885a4a8c05b97f129f6d13c15b0bbf28cc71dd1b.
What JetBrains actually does
Matching, ranking, and presentation are distinct.MinusculeMatcherImpl prepares character/case/separator metadata for a pattern, finds matching fragments, and rejects invalid matches. MinusculeMatcher scores those fragments. The fragments can drive highlighting. This is richer than accepting any subsequence and penalizing its gaps.
Original case is meaningful even in ignore-case mode. Word starts, CamelCase/acronym boundaries, skipped humps, fragment count, and matching uppercase characters affect the result. Lowercasing the pattern and candidate before calling the matcher loses information needed to reproduce this behavior.
Pattern preparation belongs to the caller. The choose-by-name provider can prepend * for search-anywhere. GotoFileItemProvider.getQualifiedNameMatcher decorates path separators with wildcards. Therefore a raw matcher assertion is not automatically the exact behavior of every Search Everywhere UI. Candidate enumeration, directory scope, and path discovery remain separate from string matching.
Layout correction is a fallback matcher.FixingLayoutMatcher creates an alternative pattern only when the pattern contains letters and all of its letters are non-ASCII. It converts characters by physical-key position. Mixed Latin/non-Latin letter queries do not trigger this fallback.
Fallback is selected per candidate.MatcherWithFallback tries the original matching fragments first for each candidate, then the converted pattern. It does not itself enforce a global rule that every direct hit outranks every converted hit in a result list. T3's maintainer-confirmed direct-hit precedence should be represented explicitly rather than assumed from this class.
This mechanism does not enumerate all installed layouts.KeyboardLayoutUtil learns non-ASCII-to-ASCII mappings from key events. It falls back to a static Russian mapping when the learned map is empty, and on Linux. The converter is injected into the matching layer, which is a useful separation for T3.
Typo tolerance is optional.NameUtil.MatcherBuilder can add typo tolerance, prefer-start behavior, all-occurrence matching, and a Pinyin wrapper. They are separate choices, not requirements for the first port. The core camel-hump implementation also has a long-pattern fallback above 100 characters; unconstrained backtracking would not be an equivalent port.
Case-insensitive startsWith; separate exact-entry detection controls navigation/Enter. A name matcher can run over the already loaded directory entries without introducing recursive discovery.
Lower score is better; normalized lowercase input; caller-specific exact/prefix/boundary/substring/subsequence bases. Used by model/skill/slash search. Raw JetBrains scores are not interchangeable with these numeric contracts.
Already detects CamelCase/acronym/digit boundaries, handles phrases/tokens and optional typo passes, returns highlight ranges, and participates in grouping/use-history ranking. Web and mobile palettes use it. Replacing searchRanking alone does not update this path.
Server uses native fff indexing/ranking, not the small shared matcher. A client cannot recover candidates that a raw-query server prefilter never returned. Layout variants would need to reach this boundary; replacing fff is outside the first slice.
Preserves server ordering and computes local subsequence highlights. If the server matched an alternative layout, highlights need the actual matched pattern/fragments rather than the original query alone.
An existing browser layout-map adapter is used by the terminal in apps/web/src/terminal/ghostty/keyCodes.ts. It is not a search adapter or an installed-layout catalogue. The Keyboard Map API specification provides a keyboard mapping, not an enumeration of every installed layout, and is not uniformly available across clients. Native desktop capabilities can be an optional provider; shared matching must work without them. A remote server's OS layout is not the user's client layout.
Behavior probe
Ran a read-only Node probe importing T3's actual searchRanking, paletteSearch, and filterFilesystemBrowseEntries functions. JetBrains expectations below come from its upstream golden assertions, not from executing the JVM matcher.
Query / candidate
JetBrains assertion
T3 simple subsequence
T3 palette
T3 folder filter
NUT / NameUtilTest
Match
Match
No match
No match
NUT / NameutilTest
No match
Match
No match
No match
NeUT / NameUtilTest
No match
Match
No match
No match
na ut / name_util_test
Match
No match
Match
No match
BLWN / base-layout-without-navigation.xhtml
Match
Match
No match
No match
ыек / String
Match through layout fallback
No match
No match
No match
The JetBrains ranking test prefers ProjectView over PROVIDER for ProVi. T3's lowercase subsequence scorer orders PROVIDER first (scores 3 versus 22, lower is better). The probe also confirmed that ьщвуд does not find model in any of the three tested T3 functions, whereas an intentional Cyrillic prefix док still finds Документы in the palette and folder filter. Original-script matching must survive any layout fallback.
The JVM matcher itself was not run. This first pass establishes source semantics and current T3 differences; it does not claim end-to-end JetBrains compatibility or benchmark results. Production files and lockfiles are unchanged.
Proposed first implementation slice
Prepare a small, pure TypeScript name matcher and layout-fallback wrapper behind an explicit API, preserving the raw pattern/candidate, match fragments, and whether the original or alternative pattern matched. Prepare query metadata once per query rather than once per candidate. Keep direct-versus-converted priority explicit in the outer comparison; do not rely on a huge score penalty.
First exercise it in the shared local-folder filtering path and its web/desktop/mobile consumers, preserving directory scope, hidden-entry rules, literal names, and exact-entry/Enter behavior. This gives a coherent user-visible slice without changing server indexing or thread-history ranking. Layout conversion should be injectable so a narrow fallback and richer client-derived mappings can evolve independently. This is a proposal for our fork; upstream scope still needs to be agreed in the existing discussion.
Before integrating broadly:
Build a source-linked golden corpus for positive matches, deliberate nonmatches, ranking, and highlight fragments. Include both beginning-anchored and UI-style search-anywhere patterns.
Decide whether initial layout recovery is non-Latin-to-ASCII only, or also supports reverse and mixed-script queries; the latter exceed the existing upstream-approved direction.
Include literal Cyrillic names, Shift versus Caps Lock punctuation, pasted text, composition/IME input, and clients without physical-key metadata. Do not rewrite composer/input text.
Compare behavior on representative folder lists and preserve stable ties, model favorites, and palette/history policies where those later integrate.
Inspect the selected source-file Apache-2.0 notices and account for attribution if source is ported. The current module is built as a JVM library and cannot simply be imported into the web/mobile clients.
The next concrete step is an isolated matcher/corpus prototype for our fork, followed by deciding which JetBrains behaviors we actually want. No upstream comment or PR has been posted.
Deep dive: verified behavior of the actual JetBrains matcher
This supersedes the first pass's JVM-execution limitation. I downloaded and ran the official com.jetbrains.intellij.platform:util-text-matching:262.11879.74 artifact with its matching util-base, util-base-multiplatform, and util-rt dependencies, Kotlin stdlib 2.4.0, and annotations 26.0.2. Execution used the installed JBR 25 in a separate headless Java process; no IDE instance or user project state was opened.
The published sources of MinusculeMatcher, MinusculeMatcherImpl, NameUtil, MatcherWithFallback, FixingLayoutMatcher, and KeyboardLayoutUtil are identical, after normalizing line endings, to the previously pinned upstream revision 885a4a8c05b97f129f6d13c15b0bbf28cc71dd1b.
Verification:
Extracted 258 literal positive/negative matching assertions from upstream NameUtilMatchingTest.kt and ran their pattern/candidate pairs on the actual published matcher: 258/258 reproduced.
Extracted 39 literal preference assertions, retaining their declared matching mode or the helper's FIRST_LETTER default: 39/39 reproduced.
Ran 81 additional pattern/candidate combinations across ten scenarios, collecting scores, exact match fragments, direct-versus-layout matching, and prefer-start scores.
Ran separate process-local experiments for learned keyboard mappings and optional typo tolerance.
These are reproducible subsets of the upstream assertions plus exploration, not a claim that the complete JetBrains test suite or the Search Everywhere UI was executed. No timing/performance conclusions are claimed.
DefaultChooseByNameItemProvider can decorate patterns with a leading *, prioritizes name equality before its normal comparison, and can use a product-specific matcher factory before the default. GotoFileItemProvider separately prepares file-name and qualifier patterns, transforms slash/backslash path constraints, prioritizes exact prefixes in its name comparator, and scores directory qualifiers separately. Its qualifier score penalizes unmatched trailing path length and rewards exact paths. Thus importing one matching class would not automatically recreate all JetBrains navigation behavior.
Modern Search Everywhere additionally exposes recent-files-first, ML ranking, and semantic-search settings. A score below describes the standalone name matcher, not an unconditional position in the IDE's final mixed results.
2. This is fragment/word-hump matching, not unrestricted subsequence matching
The matcher precomputes pattern character/case/separator metadata. It first rejects impossible candidates using length and an ordered-character check, then attempts contiguous fragments and permissible jumps. If a long fragment prevents matching the rest, it can shorten that fragment and try another valid continuation. It deliberately searches later hump starts when an uppercase query character signals a better match than taking the next lowercase character of a contiguous prefix.
Concrete actual results (IGNORE_CASE unless noted):
NUT matches the three hump starts of NameUtilTest, but rejects NameutilTest.
CU highlights the C and later U in CurrentUser; lowercase cu highlights the contiguous initial Cu instead.
code rejects t3code in the raw beginning-anchored matcher; *code matches its suffix. The UI's pattern decoration is therefore essential when interpreting examples.
na ut matches name_util_test and can skip an intermediate word. Space and star are pattern operators; they are not interchangeable in all positions. A star allows middle-of-word searching; a space looks for a word boundary.
*12 matches Item12, Item123, and Item120, but rejects Item102. Consecutive digits cannot jump across another digit.
Dots constrain matching rather than behaving like regex dots. jjs matches jquery.autocomplete.js, while ja.js does not; the explicitly typed dot prevents skipping another dot in that continuation.
? is literal in this matcher. f?o rejects foo, whereas f*o matches it.
The source also limits camel-hump matching to patterns of at most 100 characters, with a simpler substring path above that threshold. This is part of bounding the cost of richer matching.
3. How matchingDegree works
Higher is better. A nonmatch is represented by Int.MIN_VALUE and null fragments.
For this default core, the score consists of:
+1000 for starting at a word boundary;
case/hump matching adjustments, including +50 for an exactly matched uppercase pattern character;
penalties for additional fragments and skipped humps;
small adjustments for start/end alignment and hard-separator position.
This is not a single edit distance. Uppercase characters communicate intent even with IGNORE_CASE. ProVi scores ProjectView at 1101 and PROVIDER at 1099. Lowercase provi reverses that order: 990 and 1001, respectively. Therefore case-folding both inputs before matching cannot preserve this behavior.
For NUT versus NameUtilTest, the base score is 1150: word start 1000, three uppercase matches 150, three fragments -3, no preceding hard separator +2, start alignment +1.
The optional PreferStartMatchMatcherWrapper adds 10000 when the first matching fragment begins at index 0. This is a separate wrapper, not an inherent property of every matcher. Caller equality/prefix checks and UI ranking policies remain separate again.
Found the real population call site, rather than relying only on a utility comment:
IdeKeyEventDispatcher.dispatchKeyEvent calls its layout-recording helper on KEY_PRESSED.
The helper ignores undefined characters and events containing modifiers other than Shift.
It calls KeyboardLayoutUtil.storeAsciiForChar with the event key code, produced character, and A-Z key-code bounds.
The utility records non-ASCII produced characters against the corresponding ASCII letter key. Existing recorded characters are not overwritten.
FixingLayoutMatcher.fixLayout permits conversion only when the pattern contains letters and none of those letters are ASCII. Nonletter punctuation is allowed in such a pattern.
It constructs one alternative pattern through the converter. MatcherWithFallback tries the original fragments for each candidate and uses the alternative if needed.
It does not request a list of installed input languages, run phonetic transliteration, or rewrite the input text. A learned mapping and a Russian-to-English static fallback explain this mechanism.
Verified edge cases:
ьщвуд converts to model; ыек converts to str and finds String.
mщdel receives no alternative pattern because it contains ASCII letters.
Intended Cyrillic док still matches Документы through the original matcher.
Latin ljr does not reverse-convert to the Cyrillic prefix док.
Uppercase ЬЩВУД converts to MODEL, but Ж converts to ;, not :. Uppercase is not a reliable substitute for knowing the punctuation shift level.
On Windows, with an empty learned map, й maps to q through the static fallback. After recording only ф -> a, asking for the still-unrecorded й returns null: the Russian fallback is used when the map is empty, or on Linux, rather than filling every gap in a nonempty learned map. Pasted/unobserved characters can consequently behave differently from characters just typed in that IDE session.
The original Cyrillic name ьщвуд and the converted Latin name model both get standalone score 1004 for query ьщвуд. This confirms that the core fallback does not globally demote all layout-derived results. If T3 requires global direct-hit precedence, that must be explicit in T3's outer comparator.
Actual probes rejected modle/model, githbu/GitHub, t3cdoe/t3code, and projetc/Project with the plain builder and accepted all four with .typoTolerant(). NameUtil only enables that optional path for patterns up to 13 characters. This does not make typo tolerance a universal property of every JetBrains search popup; action search also has its own correction settings/services.
Implications for our fork
The first product decision should be the desired acceptance rules, not a library swap:
JetBrains-style word-hump matching rejects some queries that a permissive subsequence algorithm accepts. Decide whether that reduced noise is what we want in a folder picker.
Preserve raw case, return fragments, and separate match quality from layout-origin priority and UI policy.
Keep folder enumeration/path navigation independent. Search-anywhere name decoration is a local pattern choice, not a requirement to scan the disk recursively.
Treat layout correction as an injected candidate-pattern provider. We can intentionally improve the limitations of the observed JetBrains implementation instead of inheriting them accidentally.
Keep the richer existing T3 palette engine and native fff search as separate integration decisions; none is equivalent to the small shared scorer.
An interactive explainer in this thread is backed by the 81 measured results. It changes the selected measured case and displays the actual match fragments/scores; it does not contain a JavaScript approximation of the JetBrains algorithm. No T3 production code was changed.
changed the title [-]Investigate JetBrains-style fuzzy search and keyboard layout fallback[/-][+]Design keyboard-layout tolerant search with a matcher-independent core[/+]on Oct 30, 2026
Implemented the first local slice on bugfix/keyboard-layout-folder-search (not pushed; no PR created).
getSearchQueryVariants in packages/shared produces the original query followed by deduplicated whole-query positional readings. It does not score or match candidates, so a later fuzzy matcher can consume the same raw variants and their provenance.
filterFilesystemBrowseEntries uses those readings with its existing prefix predicate. For example, ьщвуд now finds model. Literal Cyrillic matches still precede recovered matches; each entry occurs once. Hidden-folder rules, input text, and literal exact-name/Enter handling are preserved. Default recovery is RU to US QWERTY; ASCII/mixed-script queries stay literal.
Surface audit: web command-palette project browsing and clone-destination browsing use this shared function; desktop wraps web; mobile Add Project also uses it. The conversion applies only to the leaf filter, so directory discovery and RPC contracts do not change. Providers, MCP, and connection transports need no new behavior for this client-side slice. Other search matchers and fuzzy behavior are unchanged.
Verification:
Added the folder-filter regression first and observed it fail because recovered folders were missing, then implemented the fix.
Focused run: 60 tests passed across query variants, filesystem state, and existing command-palette logic.
vp run check:changed: passed (format, lint, both knip passes, patch check, affected typechecks, adjacent tests).
vp run build:desktop: 5/5 successful.
Dev Vite served the updated filesystem module with its new shared import successfully after restarting to clear the cached export list. Desktop was relaunched against the isolated worktree .t3 state.
No automated UI interaction or native mobile pass was performed in this turn; test and compile results are not a claim of visual verification.
The issue stays open for review and further decisions; no upstream submission was made.
The current implementation has exactly one production consumer of getSearchQueryVariants: packages/client-runtime/src/state/filesystem.ts. It covers folder browsing in web/desktop and mobile, including clone destinations. Searching existing project titles is a different path and has not gained layout recovery.
Other paths inspected:
Commands, existing projects, thread titles and sidebar/archive filtering: paletteSearch plus separate web/mobile adapters. They do not call the new helper. Group quality, typo fallback, picks/history, per-group limits, and highlighting need to preserve their existing behavior.
Models: the web picker uses modelPickerSearch/searchRanking; mobile's modelMatchesCatalogQuery uses substring matching. Provider settings have another model filter. None is connected.
Skills and slash commands: web uses providerSkillSearch and composerSlashCommandSearch; mobile has its own command menu and skill predicate. None is connected. Syntax such as skill: must be separated before applying recovery to the searchable payload.
Settings: web uses a token/substring ranker; mobile uses paletteSearch. Neither is connected.
Branches, PR metadata, keybindings, and mobile project selectors have independent local predicates. There is no single UI input or normalization hook that automatically covers them all.
Workspace filename/path search is selected and limited by native fff on the server (WorkspaceEntries.search / WorkspaceSearchIndex.search). Query alternatives must reach candidate selection; expanding a UI postfilter alone loses candidates. File highlighting also needs the actual reading that matched.
Thread/message search combines local title ranking with server FTS selection, older-thread retrieval, snippets, and navigation. Recovery must be applied consistently before server selection and carried through highlights/navigation.
Content/code search supports case-sensitive and regex modes. Those need an explicit policy before introducing alternate readings.
The variant representation is matcher-independent and can feed prefix, substring, or existing fuzzy matchers. Its current keyboard policy is intentionally narrower: Russian-to-US fallback; any ASCII letter suppresses conversion. Read-only runtime probes confirmed that ьщвуд yields model, while claude ыщттуе and skill:ьщвуд remain literal. Even an explicitly supplied ASCII-to-Cyrillic map is suppressed by the current ASCII guard. Supporting arbitrary directions or mixed scripts therefore requires separating that policy from generic mapping, rather than merely adding a table.
For additional adapters, generate alternatives once per search, evaluate complete readings with the existing matcher, retain provenance/matched reading, deduplicate by existing identity, and apply origin priority before the existing ordering and final limit. Avoid score offsets: the existing matchers have different score directions and group policies.
This was a read-only implementation audit; no additional search surfaces or matching behavior were changed.
Design follow-up: the common boundary is a complete query search pass
The broadest existing integration point is packages/shared/src/paletteSearch.ts: rankSearchItems delegates to rankSearchGroups, shared by palettes, title/sidebar/archive searches, mobile settings, and server thread ranking. Other selector rankers and native/FTS searches still need adapters. There is no current single runtime function that owns all app search semantics.
A concrete runtime probe found why injecting query variants inside a candidate scorer is unsafe:
Query: ьщвуд; candidates: ьщву, model.
Existing rankSearchItems + scoreSearchTerms returns ьщву through its typo pass.
Wrapping each candidate scorer to try ьщвуд and model returns only model: the recovered strong hit disables the original query's typo pass globally.
Independent runs of the existing ranker return ьщву for the original reading and model for the recovered reading. Their results can then be merged without deleting the original match.
Another probe confirmed that ьщвуд еуые has the complete readings ьщвуд еуые and model test; neither matches ьщвуд test. Expanding individual tokens would create a mixed reading that the generator never produced.
Proposed minimal common model:
The feature parses its own syntax/scope once (directory plus leaf, > action mode, skill: payload, etc.). Keep the entered query intact.
Generate raw whole-query readings once. Keep mapping eligibility separate from the generic mapping mechanism if arbitrary directions are added; retain today's conservative default for this slice.
Run the existing complete search/ranking pipeline independently per reading. Normalize/tokenize after generating each reading. Preserve its existing typo passes, candidate scope, scores, favorites, history, and match ranges.
Keep the reading with each result: original input for history and UI, effective matched query for highlighting and find navigation. scoreThreadSearch currently uses one query for lexical matching and pick history, so a later adapter needs to separate those concerns while preserving current defaults.
Provide a small stable merge helper for already ranked flat results: original pass first, deduplicate with the caller's scoped identity, retain winner metadata, then apply the final limit. It must not interpret scores or invent a common score scale. Existing per-pass top-K limits can remain where appropriate.
Grouped/sectioned searches own their merge policy. Keep fixed groups, secondary rows, title/message slots, and presentation ordering in their existing owners. The generic layer supplies reading provenance, not a global comparator or renderer.
One policy refinement needs to be explicit before implementing grouped adapters: the earlier blanket statement that all literal hits precede all recovered hits conflicts with contiguous existing groups. If groups A and B both have literal hits and A also has recovered hits, a global append either repeats A after B or puts a recovered A hit before a literal B hit. Proposed resolution: preserve structural group/section rules; original-reading priority applies within the same ordering domain. Existing literal groups keep their order, and recovered-only groups are appended in their own existing ranked order. This is a proposal, not an implemented policy change.
For the folder adapter, the current hidden-entry and literal exactEntry checks remain outside expansion. For other features, synthetic creation rows and action arguments likewise keep the original input. For server-selected files/messages, query passes must run before fff/FTS selection, with existing debounce/cancellation/auth/limits retained at their current boundaries.
Recommended delivery: establish the small common query/flat-result helpers on the existing folder slice, then extend the shared palette ranker and its adapters with dedicated regression cases for typo gating, groups, secondary items, history, and highlighting. Connect model/skill/settings selectors through the same model afterward. Native/FTS searches remain an explicit later adapter step.
No source changes were made during this design investigation.
Activity
iXab3r commentedon Oct 30, 2026
First research pass: matcher behavior and T3 integration
Reference revisions: T3
6575ce32508bd7908444241f3719aa33aaf77f90; JetBrains IntelliJ Community885a4a8c05b97f129f6d13c15b0bbf28cc71dd1b.What JetBrains actually does
MinusculeMatcherImplprepares character/case/separator metadata for a pattern, finds matching fragments, and rejects invalid matches.MinusculeMatcherscores those fragments. The fragments can drive highlighting. This is richer than accepting any subsequence and penalizing its gaps.*for search-anywhere.GotoFileItemProvider.getQualifiedNameMatcherdecorates path separators with wildcards. Therefore a raw matcher assertion is not automatically the exact behavior of every Search Everywhere UI. Candidate enumeration, directory scope, and path discovery remain separate from string matching.FixingLayoutMatchercreates an alternative pattern only when the pattern contains letters and all of its letters are non-ASCII. It converts characters by physical-key position. Mixed Latin/non-Latin letter queries do not trigger this fallback.MatcherWithFallbacktries the original matching fragments first for each candidate, then the converted pattern. It does not itself enforce a global rule that every direct hit outranks every converted hit in a result list. T3's maintainer-confirmed direct-hit precedence should be represented explicitly rather than assumed from this class.KeyboardLayoutUtillearns non-ASCII-to-ASCII mappings from key events. It falls back to a static Russian mapping when the learned map is empty, and on Linux. The converter is injected into the matching layer, which is a useful separation for T3.NameUtil.MatcherBuildercan add typo tolerance, prefer-start behavior, all-occurrence matching, and a Pinyin wrapper. They are separate choices, not requirements for the first port. The core camel-hump implementation also has a long-pattern fallback above 100 characters; unconstrained backtracking would not be an equivalent port.Pinned source:
Current T3 search is several different engines
startsWith; separate exact-entry detection controls navigation/Enter. A name matcher can run over the already loaded directory entries without introducing recursive discovery.fffindexing/ranking, not the small shared matcher. A client cannot recover candidates that a raw-query server prefilter never returned. Layout variants would need to reach this boundary; replacing fff is outside the first slice.An existing browser layout-map adapter is used by the terminal in
apps/web/src/terminal/ghostty/keyCodes.ts. It is not a search adapter or an installed-layout catalogue. The Keyboard Map API specification provides a keyboard mapping, not an enumeration of every installed layout, and is not uniformly available across clients. Native desktop capabilities can be an optional provider; shared matching must work without them. A remote server's OS layout is not the user's client layout.Behavior probe
Ran a read-only Node probe importing T3's actual
searchRanking,paletteSearch, andfilterFilesystemBrowseEntriesfunctions. JetBrains expectations below come from its upstream golden assertions, not from executing the JVM matcher.NUT/NameUtilTestNUT/NameutilTestNeUT/NameUtilTestna ut/name_util_testBLWN/base-layout-without-navigation.xhtmlыек/StringThe JetBrains ranking test prefers
ProjectViewoverPROVIDERforProVi. T3's lowercase subsequence scorer ordersPROVIDERfirst (scores 3 versus 22, lower is better). The probe also confirmed thatьщвудdoes not findmodelin any of the three tested T3 functions, whereas an intentional Cyrillic prefixдокstill findsДокументыin the palette and folder filter. Original-script matching must survive any layout fallback.The JVM matcher itself was not run. This first pass establishes source semantics and current T3 differences; it does not claim end-to-end JetBrains compatibility or benchmark results. Production files and lockfiles are unchanged.
Proposed first implementation slice
Prepare a small, pure TypeScript name matcher and layout-fallback wrapper behind an explicit API, preserving the raw pattern/candidate, match fragments, and whether the original or alternative pattern matched. Prepare query metadata once per query rather than once per candidate. Keep direct-versus-converted priority explicit in the outer comparison; do not rely on a huge score penalty.
First exercise it in the shared local-folder filtering path and its web/desktop/mobile consumers, preserving directory scope, hidden-entry rules, literal names, and exact-entry/Enter behavior. This gives a coherent user-visible slice without changing server indexing or thread-history ranking. Layout conversion should be injectable so a narrow fallback and richer client-derived mappings can evolve independently. This is a proposal for our fork; upstream scope still needs to be agreed in the existing discussion.
Before integrating broadly:
The next concrete step is an isolated matcher/corpus prototype for our fork, followed by deciding which JetBrains behaviors we actually want. No upstream comment or PR has been posted.
iXab3r commentedon Oct 30, 2026
Deep dive: verified behavior of the actual JetBrains matcher
This supersedes the first pass's JVM-execution limitation. I downloaded and ran the official
com.jetbrains.intellij.platform:util-text-matching:262.11879.74artifact with its matchingutil-base,util-base-multiplatform, andutil-rtdependencies, Kotlin stdlib 2.4.0, and annotations 26.0.2. Execution used the installed JBR 25 in a separate headless Java process; no IDE instance or user project state was opened.The published sources of
MinusculeMatcher,MinusculeMatcherImpl,NameUtil,MatcherWithFallback,FixingLayoutMatcher, andKeyboardLayoutUtilare identical, after normalizing line endings, to the previously pinned upstream revision885a4a8c05b97f129f6d13c15b0bbf28cc71dd1b.Verification:
NameUtilMatchingTest.ktand ran their pattern/candidate pairs on the actual published matcher: 258/258 reproduced.These are reproducible subsets of the upstream assertions plus exploration, not a claim that the complete JetBrains test suite or the Search Everywhere UI was executed. No timing/performance conclusions are claimed.
1. The complete path has multiple layers
UI query -> name/path pattern preparation -> candidate scope/index -> compiled string matcher -> fragments + matching degree -> caller sorting/grouping -> optional history/ML ranking -> rendered/highlighted result.DefaultChooseByNameItemProvidercan decorate patterns with a leading*, prioritizes name equality before its normal comparison, and can use a product-specific matcher factory before the default.GotoFileItemProviderseparately prepares file-name and qualifier patterns, transforms slash/backslash path constraints, prioritizes exact prefixes in its name comparator, and scores directory qualifiers separately. Its qualifier score penalizes unmatched trailing path length and rewards exact paths. Thus importing one matching class would not automatically recreate all JetBrains navigation behavior.Modern Search Everywhere additionally exposes recent-files-first, ML ranking, and semantic-search settings. A score below describes the standalone name matcher, not an unconditional position in the IDE's final mixed results.
References: query preparation and matcher factory, file/path processing, Search Everywhere settings.
2. This is fragment/word-hump matching, not unrestricted subsequence matching
The matcher precomputes pattern character/case/separator metadata. It first rejects impossible candidates using length and an ordered-character check, then attempts contiguous fragments and permissible jumps. If a long fragment prevents matching the rest, it can shorten that fragment and try another valid continuation. It deliberately searches later hump starts when an uppercase query character signals a better match than taking the next lowercase character of a contiguous prefix.
Concrete actual results (IGNORE_CASE unless noted):
NUTmatches the three hump starts ofNameUtilTest, but rejectsNameutilTest.CUhighlights the C and later U inCurrentUser; lowercasecuhighlights the contiguous initial Cu instead.tcdand*tcdboth rejectt3code;t3cmatches it. Accepting arbitrary letter gaps, as in PR feat(client): add-project folder search matches substrings and fuzzy subsequences pingdotgg/t3code#26376, is a different behavior.coderejectst3codein the raw beginning-anchored matcher;*codematches its suffix. The UI's pattern decoration is therefore essential when interpreting examples.na utmatchesname_util_testand can skip an intermediate word. Space and star are pattern operators; they are not interchangeable in all positions. A star allows middle-of-word searching; a space looks for a word boundary.*12matchesItem12,Item123, andItem120, but rejectsItem102. Consecutive digits cannot jump across another digit.jjsmatchesjquery.autocomplete.js, whileja.jsdoes not; the explicitly typed dot prevents skipping another dot in that continuation.?is literal in this matcher.f?orejectsfoo, whereasf*omatches it.The source also limits camel-hump matching to patterns of at most 100 characters, with a simpler substring path above that threshold. This is part of bounding the cost of richer matching.
3. How matchingDegree works
Higher is better. A nonmatch is represented by
Int.MIN_VALUEand null fragments.For this default core, the score consists of:
This is not a single edit distance. Uppercase characters communicate intent even with IGNORE_CASE.
ProViscoresProjectViewat 1101 andPROVIDERat 1099. Lowercaseprovireverses that order: 990 and 1001, respectively. Therefore case-folding both inputs before matching cannot preserve this behavior.For
NUTversusNameUtilTest, the base score is 1150: word start 1000, three uppercase matches 150, three fragments -3, no preceding hard separator +2, start alignment +1.The optional
PreferStartMatchMatcherWrapperadds 10000 when the first matching fragment begins at index 0. This is a separate wrapper, not an inherent property of every matcher. Caller equality/prefix checks and UI ranking policies remain separate again.4. Wrong-layout recovery: exact event-to-fallback chain
Found the real population call site, rather than relying only on a utility comment:
IdeKeyEventDispatcher.dispatchKeyEventcalls its layout-recording helper on KEY_PRESSED.KeyboardLayoutUtil.storeAsciiForCharwith the event key code, produced character, and A-Z key-code bounds.FixingLayoutMatcher.fixLayoutpermits conversion only when the pattern contains letters and none of those letters are ASCII. Nonletter punctuation is allowed in such a pattern.MatcherWithFallbacktries the original fragments for each candidate and uses the alternative if needed.It does not request a list of installed input languages, run phonetic transliteration, or rewrite the input text. A learned mapping and a Russian-to-English static fallback explain this mechanism.
Verified edge cases:
ьщвудconverts tomodel;ыекconverts tostrand findsString.mщdelreceives no alternative pattern because it contains ASCII letters.докstill matchesДокументыthrough the original matcher.ljrdoes not reverse-convert to the Cyrillic prefix док.ЬЩВУДconverts toMODEL, butЖconverts to;, not:. Uppercase is not a reliable substitute for knowing the punctuation shift level.ьщвудand the converted Latin namemodelboth get standalone score 1004 for queryьщвуд. This confirms that the core fallback does not globally demote all layout-derived results. If T3 requires global direct-hit precedence, that must be explicit in T3's outer comparator.Sources: event capture, capture filtering, runtime mapping and platform fallback, fallback eligibility.
5. Typo tolerance is independent
Actual probes rejected
modle/model,githbu/GitHub,t3cdoe/t3code, andprojetc/Projectwith the plain builder and accepted all four with.typoTolerant(). NameUtil only enables that optional path for patterns up to 13 characters. This does not make typo tolerance a universal property of every JetBrains search popup; action search also has its own correction settings/services.Implications for our fork
The first product decision should be the desired acceptance rules, not a library swap:
An interactive explainer in this thread is backed by the 81 measured results. It changes the selected measured case and displays the actual match fragments/scores; it does not contain a JavaScript approximation of the JetBrains algorithm. No T3 production code was changed.
[-]Investigate JetBrains-style fuzzy search and keyboard layout fallback[/-][+]Design keyboard-layout tolerant search with a matcher-independent core[/+]iXab3r commentedon Oct 30, 2026
Implemented the first local slice on
bugfix/keyboard-layout-folder-search(not pushed; no PR created).getSearchQueryVariantsinpackages/sharedproduces the original query followed by deduplicated whole-query positional readings. It does not score or match candidates, so a later fuzzy matcher can consume the same raw variants and their provenance.filterFilesystemBrowseEntriesuses those readings with its existing prefix predicate. For example,ьщвудnow findsmodel. Literal Cyrillic matches still precede recovered matches; each entry occurs once. Hidden-folder rules, input text, and literal exact-name/Enter handling are preserved. Default recovery is RU to US QWERTY; ASCII/mixed-script queries stay literal.Surface audit: web command-palette project browsing and clone-destination browsing use this shared function; desktop wraps web; mobile Add Project also uses it. The conversion applies only to the leaf filter, so directory discovery and RPC contracts do not change. Providers, MCP, and connection transports need no new behavior for this client-side slice. Other search matchers and fuzzy behavior are unchanged.
Verification:
vp run check:changed: passed (format, lint, both knip passes, patch check, affected typechecks, adjacent tests).vp run build:desktop: 5/5 successful..t3state.The issue stays open for review and further decisions; no upstream submission was made.
iXab3r commentedon Oct 30, 2026
Follow-up audit: reuse across the app
The current implementation has exactly one production consumer of
getSearchQueryVariants:packages/client-runtime/src/state/filesystem.ts. It covers folder browsing in web/desktop and mobile, including clone destinations. Searching existing project titles is a different path and has not gained layout recovery.Other paths inspected:
paletteSearchplus separate web/mobile adapters. They do not call the new helper. Group quality, typo fallback, picks/history, per-group limits, and highlighting need to preserve their existing behavior.modelPickerSearch/searchRanking; mobile'smodelMatchesCatalogQueryuses substring matching. Provider settings have another model filter. None is connected.providerSkillSearchandcomposerSlashCommandSearch; mobile has its own command menu and skill predicate. None is connected. Syntax such asskill:must be separated before applying recovery to the searchable payload.paletteSearch. Neither is connected.WorkspaceEntries.search/WorkspaceSearchIndex.search). Query alternatives must reach candidate selection; expanding a UI postfilter alone loses candidates. File highlighting also needs the actual reading that matched.The variant representation is matcher-independent and can feed prefix, substring, or existing fuzzy matchers. Its current keyboard policy is intentionally narrower: Russian-to-US fallback; any ASCII letter suppresses conversion. Read-only runtime probes confirmed that
ьщвудyieldsmodel, whileclaude ыщттуеandskill:ьщвудremain literal. Even an explicitly supplied ASCII-to-Cyrillic map is suppressed by the current ASCII guard. Supporting arbitrary directions or mixed scripts therefore requires separating that policy from generic mapping, rather than merely adding a table.For additional adapters, generate alternatives once per search, evaluate complete readings with the existing matcher, retain provenance/matched reading, deduplicate by existing identity, and apply origin priority before the existing ordering and final limit. Avoid score offsets: the existing matchers have different score directions and group policies.
This was a read-only implementation audit; no additional search surfaces or matching behavior were changed.
iXab3r commentedon Oct 30, 2026
Design follow-up: the common boundary is a complete query search pass
The broadest existing integration point is
packages/shared/src/paletteSearch.ts:rankSearchItemsdelegates torankSearchGroups, shared by palettes, title/sidebar/archive searches, mobile settings, and server thread ranking. Other selector rankers and native/FTS searches still need adapters. There is no current single runtime function that owns all app search semantics.A concrete runtime probe found why injecting query variants inside a candidate scorer is unsafe:
ьщвуд; candidates:ьщву,model.rankSearchItems+scoreSearchTermsreturnsьщвуthrough its typo pass.ьщвудandmodelreturns onlymodel: the recovered strong hit disables the original query's typo pass globally.ьщвуfor the original reading andmodelfor the recovered reading. Their results can then be merged without deleting the original match.Another probe confirmed that
ьщвуд еуыеhas the complete readingsьщвуд еуыеandmodel test; neither matchesьщвуд test. Expanding individual tokens would create a mixed reading that the generator never produced.Proposed minimal common model:
>action mode,skill:payload, etc.). Keep the entered query intact.scoreThreadSearchcurrently uses one query for lexical matching and pick history, so a later adapter needs to separate those concerns while preserving current defaults.One policy refinement needs to be explicit before implementing grouped adapters: the earlier blanket statement that all literal hits precede all recovered hits conflicts with contiguous existing groups. If groups A and B both have literal hits and A also has recovered hits, a global append either repeats A after B or puts a recovered A hit before a literal B hit. Proposed resolution: preserve structural group/section rules; original-reading priority applies within the same ordering domain. Existing literal groups keep their order, and recovered-only groups are appended in their own existing ranked order. This is a proposal, not an implemented policy change.
For the folder adapter, the current hidden-entry and literal
exactEntrychecks remain outside expansion. For other features, synthetic creation rows and action arguments likewise keep the original input. For server-selected files/messages, query passes must run before fff/FTS selection, with existing debounce/cancellation/auth/limits retained at their current boundaries.Recommended delivery: establish the small common query/flat-result helpers on the existing folder slice, then extend the shared palette ranker and its adapters with dedicated regression cases for typo gating, groups, secondary items, history, and highlighting. Connect model/skill/settings selectors through the same model afterward. Native/FTS searches remain an explicit later adapter step.
No source changes were made during this design investigation.