mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 11:31:15 +00:00
v4
This commit is contained in:
parent
0863024b1a
commit
0a91a54794
@ -89,12 +89,12 @@ fn line_to_block(acc: &mut Assists, comment: ast::Comment) -> Option<()> {
|
|||||||
// contents of each line comment when they're put into the block comment.
|
// contents of each line comment when they're put into the block comment.
|
||||||
let indentation = IndentLevel::from_token(comment.syntax());
|
let indentation = IndentLevel::from_token(comment.syntax());
|
||||||
|
|
||||||
let cms = comments
|
let block_comment_body = comments
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|c| line_comment_text(indentation, c))
|
.map(|c| line_comment_text(indentation, c))
|
||||||
.collect::<Vec<String>>();
|
.collect::<Vec<String>>()
|
||||||
|
.into_iter()
|
||||||
let block_comment_body = cms.into_iter().join("\n");
|
.join("\n");
|
||||||
|
|
||||||
let block_prefix =
|
let block_prefix =
|
||||||
CommentKind { shape: CommentShape::Block, ..comment.kind() }.prefix();
|
CommentKind { shape: CommentShape::Block, ..comment.kind() }.prefix();
|
||||||
|
@ -55,6 +55,11 @@ pub(crate) fn desugar_doc_comment(acc: &mut Assists, ctx: &AssistContext<'_>) ->
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
acc.add(
|
||||||
|
AssistId("desugar_doc_comment", AssistKind::RefactorRewrite),
|
||||||
|
"Desugar doc-comment to attribute macro",
|
||||||
|
target,
|
||||||
|
|edit| {
|
||||||
let text = match comments {
|
let text = match comments {
|
||||||
Either::Left(comment) => {
|
Either::Left(comment) => {
|
||||||
let text = comment.text();
|
let text = comment.text();
|
||||||
@ -71,11 +76,6 @@ pub(crate) fn desugar_doc_comment(acc: &mut Assists, ctx: &AssistContext<'_>) ->
|
|||||||
.join("\n"),
|
.join("\n"),
|
||||||
};
|
};
|
||||||
|
|
||||||
acc.add(
|
|
||||||
AssistId("desugar_doc_comment", AssistKind::RefactorRewrite),
|
|
||||||
"Desugar doc-comment to attribute macro",
|
|
||||||
target,
|
|
||||||
|edit| {
|
|
||||||
let hashes = "#".repeat(required_hashes(&text));
|
let hashes = "#".repeat(required_hashes(&text));
|
||||||
|
|
||||||
let prefix = match placement {
|
let prefix = match placement {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user