diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-02-20 12:40:34 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-02-20 12:40:34 +0000 |
commit | a8beff9cf69f81653c8f633fc663550ce0a76383 (patch) | |
tree | 18ea22b950c61afddeb0115b3b0c73d84f2cd1f1 /crates/ra_ide | |
parent | 4e288c64ff83ff8de04c86037ce7f6f4c265e148 (diff) | |
parent | 5cd311d64ef8122a9d69d8ad35e82b02ba67e584 (diff) |
Merge #3248
3248: Fix off by one in onEnter r=matklad a=lnicola
Co-authored-by: Laurențiu Nicola <[email protected]>
Diffstat (limited to 'crates/ra_ide')
-rw-r--r-- | crates/ra_ide/src/typing.rs | 15 |
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 | ||
273 | fn foo() { | ||
274 | } | ||
275 | ", | ||
276 | r" | ||
277 | /// | ||
278 | /// <|> Some docs | ||
279 | fn foo() { | ||
280 | } | ||
281 | ", | ||
282 | ); | ||
270 | do_check_noop( | 283 | do_check_noop( |
271 | r" | 284 | r" |
272 | fn main() { | 285 | fn main() { |