mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 21:54:42 +00:00
Merge #107
107: Switch to absolute offsets for extend comment word r=matklad a=matklad Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
commit
434e30e19f
1 changed files with 13 additions and 4 deletions
|
@ -53,7 +53,7 @@ fn extend_single_word_in_comment(leaf: SyntaxNodeRef, offset: TextUnit) -> Optio
|
|||
let from: TextUnit = (start_idx + 1).into();
|
||||
let to: TextUnit = (cursor_position + end_idx).into();
|
||||
|
||||
Some(TextRange::from_to(from, to))
|
||||
Some(TextRange::from_to(from, to) + leaf.range().start())
|
||||
}
|
||||
|
||||
fn extend_ws(root: SyntaxNodeRef, ws: SyntaxNodeRef, offset: TextUnit) -> TextRange {
|
||||
|
@ -219,5 +219,14 @@ fn main() { foo+<|>bar;}
|
|||
r#"// foo bar b<|>az quxx"#,
|
||||
&["baz", "// foo bar baz quxx"]
|
||||
);
|
||||
do_check(r#"
|
||||
impl S {
|
||||
fn foo() {
|
||||
// hel<|>lo world
|
||||
}
|
||||
}
|
||||
"#,
|
||||
&["hello", "// hello world"]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue