diff options
Diffstat (limited to 'crates/ra_ide/src/display.rs')
-rw-r--r-- | crates/ra_ide/src/display.rs | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/crates/ra_ide/src/display.rs b/crates/ra_ide/src/display.rs index 827c094e7..70d2a2dd1 100644 --- a/crates/ra_ide/src/display.rs +++ b/crates/ra_ide/src/display.rs | |||
@@ -6,13 +6,10 @@ mod navigation_target; | |||
6 | mod structure; | 6 | mod structure; |
7 | mod short_label; | 7 | mod short_label; |
8 | 8 | ||
9 | use std::fmt::Display; | ||
10 | |||
11 | use ra_syntax::{ | 9 | use ra_syntax::{ |
12 | ast::{self, AstNode, AttrsOwner, NameOwner, TypeParamsOwner}, | 10 | ast::{self, AstNode, AttrsOwner, NameOwner, TypeParamsOwner}, |
13 | SyntaxKind::{ATTR, COMMENT}, | 11 | SyntaxKind::{ATTR, COMMENT}, |
14 | }; | 12 | }; |
15 | use stdx::format_to; | ||
16 | 13 | ||
17 | pub use function_signature::FunctionSignature; | 14 | pub use function_signature::FunctionSignature; |
18 | pub use navigation_target::NavigationTarget; | 15 | pub use navigation_target::NavigationTarget; |
@@ -69,29 +66,3 @@ pub(crate) fn macro_label(node: &ast::MacroCall) -> String { | |||
69 | let vis = if node.has_atom_attr("macro_export") { "#[macro_export]\n" } else { "" }; | 66 | let vis = if node.has_atom_attr("macro_export") { "#[macro_export]\n" } else { "" }; |
70 | format!("{}macro_rules! {}", vis, name) | 67 | format!("{}macro_rules! {}", vis, name) |
71 | } | 68 | } |
72 | |||
73 | pub(crate) fn rust_code_markup(code: &impl Display) -> String { | ||
74 | rust_code_markup_with_doc(code, None, None) | ||
75 | } | ||
76 | |||
77 | pub(crate) fn rust_code_markup_with_doc( | ||
78 | code: &impl Display, | ||
79 | doc: Option<&str>, | ||
80 | mod_path: Option<&str>, | ||
81 | ) -> String { | ||
82 | let mut buf = String::new(); | ||
83 | |||
84 | if let Some(mod_path) = mod_path { | ||
85 | if !mod_path.is_empty() { | ||
86 | format_to!(buf, "```rust\n{}\n```\n\n", mod_path); | ||
87 | } | ||
88 | } | ||
89 | format_to!(buf, "```rust\n{}\n```", code); | ||
90 | |||
91 | if let Some(doc) = doc { | ||
92 | format_to!(buf, "\n___"); | ||
93 | format_to!(buf, "\n\n{}", doc); | ||
94 | } | ||
95 | |||
96 | buf | ||
97 | } | ||