diff options
| author | roife <roifewu@gmail.com> | 2025-01-13 04:31:15 +0800 |
|---|---|---|
| committer | Lukas Wirth <lukastw97@gmail.com> | 2025-02-12 14:47:28 +0100 |
| commit | 0d8015cb23a99a014e7bc82c19cd81e8ffa536a3 (patch) | |
| tree | 752810c95e6d978a5e9ddc9cf29b331819554f8d /src/tools/rust-analyzer/crates/hir-def | |
| parent | da4c09937559e8d93cc6499ec8510a3571449061 (diff) | |
| download | rust-0d8015cb23a99a014e7bc82c19cd81e8ffa536a3.tar.gz rust-0d8015cb23a99a014e7bc82c19cd81e8ffa536a3.zip | |
fix: handle character boundary in search mode
Diffstat (limited to 'src/tools/rust-analyzer/crates/hir-def')
| -rw-r--r-- | src/tools/rust-analyzer/crates/hir-def/src/import_map.rs | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/tools/rust-analyzer/crates/hir-def/src/import_map.rs b/src/tools/rust-analyzer/crates/hir-def/src/import_map.rs index 6137bd34d64..d43776b8a66 100644 --- a/src/tools/rust-analyzer/crates/hir-def/src/import_map.rs +++ b/src/tools/rust-analyzer/crates/hir-def/src/import_map.rs @@ -320,7 +320,7 @@ impl SearchMode { }; match m { Some((index, _)) => { - name = &name[index + 1..]; + name = name[index..].strip_prefix(|_: char| true).unwrap_or_default(); true } None => false, @@ -1039,4 +1039,22 @@ pub mod fmt { "#]], ); } + + #[test] + fn unicode_fn_name() { + let ra_fixture = r#" + //- /main.rs crate:main deps:dep + //- /dep.rs crate:dep + pub fn あい() {} + "#; + + check_search( + ra_fixture, + "main", + Query::new("あ".to_owned()).fuzzy(), + expect![[r#" + dep::あい (f) + "#]], + ); + } } |
