mirror of
https://github.com/zed-industries/zed.git
synced 2026-05-23 21:05:08 +00:00
Stacked on top of #54112 This is part 2 of 3 towards #51197 More details from the original PR #53551 This PR includes the changes from #54112 , im not sure how to avoid that, my understanding is that after that one is merged, this PR can be rebased onto main and everything will be correct. You can also view the version of this that does reflect the changes more directly here: https://github.com/feitreim/zed/pull/1 ## Changes In this PR I added a more general string matching functionality to `fuzzy_nucleo`, in order to have proper testing for this, I also changed the command palette, tab switching picker, branch picker, and recent projects picker to use this new implementation. I think the command palette change in particular is awesome, just super nice to vaguely gesture at the command i want and have it pop right up. The main change here and departure from https://github.com/zed-industries/zed/pull/37123 is realizing that the primary reason for the regressions is actually how nucleo handles smart case, the old `fuzzy` crate only uses the smart case argument to score things differently, while nucleo actually filters on the case, eg. with smart case query "Apple" wouldnt match "apple". To get around this we always pass `CaseMatching::Ignore` to nucleo and implement the same score modifications from fuzzy in our code. There is a performance cost to that, of course, but from my testing it is fairly static, not growing as the size increases, so maybe a query takes 35 µs instead of 25 µs, but a query that takes 800 µs will only take 820 µs. Benchmark: | kind | query | size | nucleo | fuzzy | nucleo/fuzzy | |---|---|---:|---:|---:|---:| | string | 1-word | 100 | 9.15 µs | 24.6 µs | 0.37× | | string | 1-word | 1000 | 150.2 µs | 207.2 µs | 0.72× | | string | 1-word | 10000 | 1.34 ms | 2.07 ms | 0.65× | | string | 2-word | 100 | 5.16 µs | 2.94 µs | 1.75× | | string | 2-word | 1000 | 29.0 µs | 11.0 µs | 2.63× | | string | 2-word | 10000 | 210.6 µs | 55.5 µs | 3.79× | | string | 4-word | 100 | 2.57 µs | 2.33 µs | 1.10× | | string | 4-word | 1000 | 6.98 µs | 5.85 µs | 1.19× | | string | 4-word | 10000 | 20.0 µs | 12.0 µs | 1.66× | When I added the 4-word queries to the benchmarks I was actually really concerned that the performance would be awful, making it unsuitable for the command palette especially. However, I think due to the CharBag pre-filtering when the query is longer, the performance is actually way better than the 2 word case. Video: https://github.com/user-attachments/assets/3cd7221b-424f-4fd3-8df1-5543dcc340a3 Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Release Notes: - Improved fuzzy matching in the command palette, branch picker, tab switcher, and recent projects picker to support multi-word queries. --------- Co-authored-by: Yara <git@yara.blue>
103 lines
3.7 KiB
TOML
103 lines
3.7 KiB
TOML
[files]
|
|
ignore-files = true
|
|
ignore-hidden = false
|
|
extend-exclude = [
|
|
".git/",
|
|
|
|
# Typewriter model names used for agent branch names aren't typos.
|
|
"crates/agent_ui/src/branch_names.rs",
|
|
|
|
# Contributor names aren't typos.
|
|
".mailmap",
|
|
|
|
# File suffixes aren't typos.
|
|
"crates/theme/src/icon_theme.rs",
|
|
"crates/extensions_ui/src/extension_suggest.rs",
|
|
|
|
# Some mock data is flagged as typos.
|
|
"crates/assistant_tools/src/web_search_tool.rs",
|
|
|
|
# Suppress false positives in database schema.
|
|
"crates/collab/migrations/20251208000000_test_schema.sql",
|
|
|
|
# Not our typos.
|
|
"crates/livekit_api/",
|
|
# Vim makes heavy use of partial typing tables.
|
|
"crates/vim/",
|
|
# Editor, file finder, and fuzzy matching rely on partial typing and custom in-string syntax.
|
|
"crates/file_finder/src/file_finder_tests.rs",
|
|
"crates/fuzzy_nucleo/src/strings.rs",
|
|
"crates/editor/src/editor_tests.rs",
|
|
"crates/editor/src/edit_prediction_tests.rs",
|
|
# There are some names in the test data that are incorrectly flagged as typos.
|
|
"crates/git/test_data/blame_incremental_complex",
|
|
"crates/git/test_data/golden/blame_incremental_complex.json",
|
|
# We have some base64-encoded data that is incorrectly being flagged.
|
|
"crates/rpc/src/auth.rs",
|
|
# glsl isn't recognized by this tool.
|
|
"extensions/glsl/languages/glsl/",
|
|
# Protols is the name of the language server.
|
|
"extensions/proto/extension.toml",
|
|
"extensions/proto/src/language_servers/protols.rs",
|
|
# Windows likes its abbreviations.
|
|
"crates/gpui_windows/src/directx_renderer.rs",
|
|
"crates/gpui_windows/src/events.rs",
|
|
"crates/gpui_windows/src/direct_write.rs",
|
|
"crates/gpui_windows/src/window.rs",
|
|
# Some typos in the base mdBook CSS.
|
|
"docs/theme/css/",
|
|
# Automatically generated JS.
|
|
"docs/theme/c15t@*.js",
|
|
# Spellcheck triggers on `|Fixe[sd]|` regex part.
|
|
"script/danger/dangerfile.ts",
|
|
# File type extensions are not typos
|
|
"crates/zed/resources/windows/zed.iss",
|
|
# typos-cli doesn't understand our `vˇariable` markup
|
|
"crates/editor/src/hover_links.rs",
|
|
# typos-cli doesn't understand `setis` is intentional test case
|
|
"crates/editor/src/code_completion_tests.rs",
|
|
# Linux repository structure is not a valid text, hence we should not check it for typos
|
|
"crates/project_panel/benches/linux_repo_snapshot.txt",
|
|
# Some multibuffer test cases have word fragments that register as typos
|
|
"crates/multi_buffer/src/multi_buffer_tests.rs",
|
|
# Macos apis
|
|
"crates/gpui_macos/src/dispatcher.rs",
|
|
# Tests contain partially incomplete words (by design)
|
|
"crates/edit_prediction_cli/src/split_commit.rs",
|
|
"crates/edit_prediction_metrics/src/kept_rate.rs",
|
|
# Eval examples contain intentionally partial words (e.g. "secur" for "secure")
|
|
"crates/edit_prediction_cli/evals/",
|
|
# Tests contain `baˇr` that cause `"ba" should be "by" or "be".`-like false-positives
|
|
"crates/editor/src/document_symbols.rs",
|
|
]
|
|
|
|
[default]
|
|
extend-ignore-re = [
|
|
# PNG is a file format, not a typo
|
|
"PNG",
|
|
'cl\[ist]',
|
|
'\[lan\]guage',
|
|
'"ba"',
|
|
"doas",
|
|
# ProtoLS crate with tree-sitter Protobuf grammar.
|
|
"protols",
|
|
# x11rb SelectionNotifyEvent struct field
|
|
"requestor",
|
|
# macOS version
|
|
"Big Sur",
|
|
# Not an actual typo but an intentionally invalid color, in `color_extractor`
|
|
"#fof",
|
|
# Stripped version of reserved keyword `type`
|
|
"typ",
|
|
# AMD GPU Services
|
|
"ags",
|
|
# AMD GPU Services
|
|
"AGS",
|
|
# "noet" is a vim variable (ideally to ignore locally)
|
|
"noet",
|
|
# Yarn Plug'n'Play
|
|
"PnP",
|
|
# `image` crate method: Delay::from_numer_denom_ms
|
|
"numer"
|
|
]
|
|
check-filename = true
|