aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_ide/src/hover.rs17
-rw-r--r--crates/ra_syntax/src/ast/traits.rs4
2 files changed, 19 insertions, 2 deletions
diff --git a/crates/ra_ide/src/hover.rs b/crates/ra_ide/src/hover.rs
index 3f88bb260..1de3cb579 100644
--- a/crates/ra_ide/src/hover.rs
+++ b/crates/ra_ide/src/hover.rs
@@ -743,4 +743,21 @@ fn func(foo: i32) { if true { <|>foo; }; }
743 &["u32"], 743 &["u32"],
744 ); 744 );
745 } 745 }
746
747 #[test]
748 fn test_hover_non_ascii_space_doc() {
749 check_hover_result(
750 "
751 //- /lib.rs
752 /// <- `\u{3000}` here
753 fn foo() {
754 }
755
756 fn bar() {
757 fo<|>o();
758 }
759 ",
760 &["fn foo()\n```\n\n<- `\u{3000}` here"],
761 );
762 }
746} 763}
diff --git a/crates/ra_syntax/src/ast/traits.rs b/crates/ra_syntax/src/ast/traits.rs
index f99984fe0..f8cf1e3eb 100644
--- a/crates/ra_syntax/src/ast/traits.rs
+++ b/crates/ra_syntax/src/ast/traits.rs
@@ -126,8 +126,8 @@ pub trait DocCommentsOwner: AstNode {
126 126
127 // Determine if the prefix or prefix + 1 char is stripped 127 // Determine if the prefix or prefix + 1 char is stripped
128 let pos = 128 let pos =
129 if line.chars().nth(prefix_len).map(|c| c.is_whitespace()).unwrap_or(false) { 129 if let Some(ws) = line.chars().nth(prefix_len).filter(|c| c.is_whitespace()) {
130 prefix_len + 1 130 prefix_len + ws.len_utf8()
131 } else { 131 } else {
132 prefix_len 132 prefix_len
133 }; 133 };