Fix off by one in onEnter

This commit is contained in:
Laurențiu Nicola 2020-02-20 11:19:40 +02:00
parent 4e288c64ff
commit 5cd311d64e

View file

@ -42,7 +42,7 @@ pub(crate) fn on_enter(db: &RootDatabase, position: FilePosition) -> Option<Sour
let prefix = comment.prefix();
let comment_range = comment.syntax().text_range();
if position.offset < comment_range.start() + TextUnit::of_str(prefix) + TextUnit::from(1) {
if position.offset < comment_range.start() + TextUnit::of_str(prefix) {
return None;
}
@ -265,6 +265,19 @@ fn main() {
// <|> me
let x = 1 + 1;
}
",
);
do_check(
r"
///<|> Some docs
fn foo() {
}
",
r"
///
/// <|> Some docs
fn foo() {
}
",
);
do_check_noop(