Add a FIXME for non-unified inner attributes

This commit is contained in:
Kirill Bulatov 2020-11-11 14:04:31 +02:00
parent 335edf87bc
commit 3481ea96bd

View File

@ -72,6 +72,11 @@ fn insert_pos_after_inner_elements(&self) -> (InsertPosition<SyntaxElement>, 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() {}"#,