mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
Link to the specific source line
This commit is contained in:
parent
f20775d7eb
commit
899570ad7a
5 changed files with 90 additions and 36 deletions
|
@ -64,7 +64,7 @@ impl Assist {
|
|||
assert_eq!(lines.next().unwrap().as_str(), "->");
|
||||
assert_eq!(lines.next().unwrap().as_str(), "```");
|
||||
let after = take_until(lines.by_ref(), "```");
|
||||
let location = Location::new(path.to_path_buf());
|
||||
let location = Location::new(path.to_path_buf(), block.line);
|
||||
acc.push(Assist { id, location, doc, before, after })
|
||||
}
|
||||
|
||||
|
@ -90,6 +90,7 @@ impl fmt::Display for Assist {
|
|||
writeln!(
|
||||
f,
|
||||
"[discrete]\n=== `{}`
|
||||
**Source:** {}
|
||||
|
||||
{}
|
||||
|
||||
|
@ -101,6 +102,7 @@ impl fmt::Display for Assist {
|
|||
```rust
|
||||
{}```",
|
||||
self.id,
|
||||
self.location,
|
||||
self.doc,
|
||||
hide_hash_comments(&before),
|
||||
hide_hash_comments(&after)
|
||||
|
|
|
@ -40,7 +40,8 @@ impl Feature {
|
|||
let id = block.id;
|
||||
assert!(is_valid_feature_name(&id), "invalid feature name: {:?}", id);
|
||||
let doc = block.contents.join("\n");
|
||||
acc.push(Feature { id, location: Location::new(path.clone()), doc })
|
||||
let location = Location::new(path.clone(), block.line);
|
||||
acc.push(Feature { id, location, doc })
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue