aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src
diff options
context:
space:
mode:
authorLaurenČ›iu Nicola <[email protected]>2020-02-20 09:19:40 +0000
committerLaurenČ›iu Nicola <[email protected]>2020-02-20 09:24:47 +0000
commit5cd311d64ef8122a9d69d8ad35e82b02ba67e584 (patch)
tree18ea22b950c61afddeb0115b3b0c73d84f2cd1f1 /crates/ra_ide/src
parent4e288c64ff83ff8de04c86037ce7f6f4c265e148 (diff)
Fix off by one in onEnter
Diffstat (limited to 'crates/ra_ide/src')
-rw-r--r--crates/ra_ide/src/typing.rs15
1 files changed, 14 insertions, 1 deletions
diff --git a/crates/ra_ide/src/typing.rs b/crates/ra_ide/src/typing.rs
index e5d1779fd..7f1b9150f 100644
--- a/crates/ra_ide/src/typing.rs
+++ b/crates/ra_ide/src/typing.rs
@@ -42,7 +42,7 @@ pub(crate) fn on_enter(db: &RootDatabase, position: FilePosition) -> Option<Sour
42 42
43 let prefix = comment.prefix(); 43 let prefix = comment.prefix();
44 let comment_range = comment.syntax().text_range(); 44 let comment_range = comment.syntax().text_range();
45 if position.offset < comment_range.start() + TextUnit::of_str(prefix) + TextUnit::from(1) { 45 if position.offset < comment_range.start() + TextUnit::of_str(prefix) {
46 return None; 46 return None;
47 } 47 }
48 48
@@ -267,6 +267,19 @@ fn main() {
267} 267}
268", 268",
269 ); 269 );
270 do_check(
271 r"
272///<|> Some docs
273fn foo() {
274}
275",
276 r"
277///
278/// <|> Some docs
279fn foo() {
280}
281",
282 );
270 do_check_noop( 283 do_check_noop(
271 r" 284 r"
272fn main() { 285fn main() {