aboutsummaryrefslogtreecommitdiff
path: root/xtask/src/codegen
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-05-31 14:36:20 +0100
committerAleksey Kladov <[email protected]>2020-05-31 14:36:20 +0100
commit899570ad7abbc644e87d8379862c1b9f940eaf07 (patch)
treed388b80710dc570e491c26610dc914ed90cf3d37 /xtask/src/codegen
parentf20775d7ebe7d3a3c70a433dc0db62e588a387f0 (diff)
Link to the specific source line
Diffstat (limited to 'xtask/src/codegen')
-rw-r--r--xtask/src/codegen/gen_assists_docs.rs4
-rw-r--r--xtask/src/codegen/gen_feature_docs.rs3
2 files changed, 5 insertions, 2 deletions
diff --git a/xtask/src/codegen/gen_assists_docs.rs b/xtask/src/codegen/gen_assists_docs.rs
index 15a02d317..6c1be5350 100644
--- a/xtask/src/codegen/gen_assists_docs.rs
+++ b/xtask/src/codegen/gen_assists_docs.rs
@@ -64,7 +64,7 @@ impl Assist {
64 assert_eq!(lines.next().unwrap().as_str(), "->"); 64 assert_eq!(lines.next().unwrap().as_str(), "->");
65 assert_eq!(lines.next().unwrap().as_str(), "```"); 65 assert_eq!(lines.next().unwrap().as_str(), "```");
66 let after = take_until(lines.by_ref(), "```"); 66 let after = take_until(lines.by_ref(), "```");
67 let location = Location::new(path.to_path_buf()); 67 let location = Location::new(path.to_path_buf(), block.line);
68 acc.push(Assist { id, location, doc, before, after }) 68 acc.push(Assist { id, location, doc, before, after })
69 } 69 }
70 70
@@ -90,6 +90,7 @@ impl fmt::Display for Assist {
90 writeln!( 90 writeln!(
91 f, 91 f,
92 "[discrete]\n=== `{}` 92 "[discrete]\n=== `{}`
93**Source:** {}
93 94
94{} 95{}
95 96
@@ -101,6 +102,7 @@ impl fmt::Display for Assist {
101```rust 102```rust
102{}```", 103{}```",
103 self.id, 104 self.id,
105 self.location,
104 self.doc, 106 self.doc,
105 hide_hash_comments(&before), 107 hide_hash_comments(&before),
106 hide_hash_comments(&after) 108 hide_hash_comments(&after)
diff --git a/xtask/src/codegen/gen_feature_docs.rs b/xtask/src/codegen/gen_feature_docs.rs
index 731e7ecf2..31bc3839d 100644
--- a/xtask/src/codegen/gen_feature_docs.rs
+++ b/xtask/src/codegen/gen_feature_docs.rs
@@ -40,7 +40,8 @@ impl Feature {
40 let id = block.id; 40 let id = block.id;
41 assert!(is_valid_feature_name(&id), "invalid feature name: {:?}", id); 41 assert!(is_valid_feature_name(&id), "invalid feature name: {:?}", id);
42 let doc = block.contents.join("\n"); 42 let doc = block.contents.join("\n");
43 acc.push(Feature { id, location: Location::new(path.clone()), doc }) 43 let location = Location::new(path.clone(), block.line);
44 acc.push(Feature { id, location, doc })
44 } 45 }
45 46
46 Ok(()) 47 Ok(())