From 3481ea96bdf530e70ce0c3568918421564845b0d Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Wed, 11 Nov 2020 14:04:31 +0200 Subject: [PATCH] Add a FIXME for non-unified inner attributes --- crates/assists/src/utils/insert_use.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/crates/assists/src/utils/insert_use.rs b/crates/assists/src/utils/insert_use.rs index c4de83f773a..5d726370af6 100644 --- a/crates/assists/src/utils/insert_use.rs +++ b/crates/assists/src/utils/insert_use.rs @@ -72,6 +72,11 @@ fn insert_pos_after_inner_elements(&self) -> (InsertPosition, Add if is_inner_node(maybe_inner_node.clone()) { last_inner_element = Some(NodeOrToken::Node(maybe_inner_node)) } else { + // FIXME: https://doc.rust-lang.org/reference/comments.html#doc-comments + // states that inner comments (`//!` and `/*!`) are equal to inner attribute `#![doc="..."]` + // yet RA treats them differently now: inner attributes never belong to child nodes, + // but inner comments can, ergo this check. + // We need to align this and treat both cases the same way. if let Some(maybe_inner_token) = maybe_inner_node.first_token() { if is_inner_token(maybe_inner_token.clone()) { last_inner_element = Some(NodeOrToken::Token(maybe_inner_token)) @@ -877,11 +882,11 @@ fn inserts_after_multiline_inner_comments() { "foo::bar::Baz", r#"/*! Multiline inner comments do not allow any code before them. */ -/*! RA considers this inner comment belonging to the function, yet we still cannot place the code before it. */ +/*! Still an inner comment, cannot place any code before. */ fn main() {}"#, r#"/*! Multiline inner comments do not allow any code before them. */ -/*! RA considers this inner comment belonging to the function, yet we still cannot place the code before it. */ +/*! Still an inner comment, cannot place any code before. */ use foo::bar::Baz; fn main() {}"#,