aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide/src')
-rw-r--r--crates/ra_ide/src/completion/presentation.rs6
-rw-r--r--crates/ra_ide/src/hover.rs17
2 files changed, 18 insertions, 5 deletions
diff --git a/crates/ra_ide/src/completion/presentation.rs b/crates/ra_ide/src/completion/presentation.rs
index 1a3bcffae..a524987fd 100644
--- a/crates/ra_ide/src/completion/presentation.rs
+++ b/crates/ra_ide/src/completion/presentation.rs
@@ -135,11 +135,7 @@ impl Completions {
135 let (before, after) = (&docs[..idx], &docs[idx + s.len()..]); 135 let (before, after) = (&docs[..idx], &docs[idx + s.len()..]);
136 // Ensure to match the full word 136 // Ensure to match the full word
137 if after.starts_with('!') 137 if after.starts_with('!')
138 && before 138 && !before.ends_with(|c: char| c == '_' || c.is_ascii_alphanumeric())
139 .chars()
140 .rev()
141 .next()
142 .map_or(true, |c| c != '_' && !c.is_ascii_alphanumeric())
143 { 139 {
144 // It may have spaces before the braces like `foo! {}` 140 // It may have spaces before the braces like `foo! {}`
145 match after[1..].chars().find(|&c| !c.is_whitespace()) { 141 match after[1..].chars().find(|&c| !c.is_whitespace()) {
diff --git a/crates/ra_ide/src/hover.rs b/crates/ra_ide/src/hover.rs
index 0bbaa0855..6d4416c0b 100644
--- a/crates/ra_ide/src/hover.rs
+++ b/crates/ra_ide/src/hover.rs
@@ -751,4 +751,21 @@ fn func(foo: i32) { if true { <|>foo; }; }
751 751
752 assert_eq!(hover_on, "bar") 752 assert_eq!(hover_on, "bar")
753 } 753 }
754
755 #[test]
756 fn test_hover_non_ascii_space_doc() {
757 check_hover_result(
758 "
759 //- /lib.rs
760 /// <- `\u{3000}` here
761 fn foo() {
762 }
763
764 fn bar() {
765 fo<|>o();
766 }
767 ",
768 &["fn foo()\n```\n\n<- `\u{3000}` here"],
769 );
770 }
754} 771}