about summary refs log tree commit diff
path: root/src/tools/rust-analyzer/crates/hir-def
diff options
context:
space:
mode:
authorLukas Wirth <lukastw97@gmail.com>2025-02-12 14:07:51 +0000
committerGitHub <noreply@github.com>2025-02-12 14:07:51 +0000
commit537f4b258f4e8718b6c4b01103740da18be544a7 (patch)
tree26a90acd0689825d6aa4a589fa749cf81d899e31 /src/tools/rust-analyzer/crates/hir-def
parent2de75297fc2f9ac91d26d51e5e5ff88be1986bd1 (diff)
parent0d8015cb23a99a014e7bc82c19cd81e8ffa536a3 (diff)
downloadrust-537f4b258f4e8718b6c4b01103740da18be544a7.tar.gz
rust-537f4b258f4e8718b6c4b01103740da18be544a7.zip
Merge pull request #18928 from roife/fix-18918
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.rs20
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)
+        "#]],
+        );
+    }
 }