-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Description
E.g. for cases like:
# In argument
x <- matrix(
# fmt: table
c(
1, 2,
10, 200
),
ncol = 2
)I see two issues.
- In
can_have_directives(), we're checking whether the parent is an argument list, rather than an argument. - Comments get attached to argument nodes, not call nodes. Which is probably fine? But we need to acknowledge that.
Details
[crates/air_r_formatter/src/comments_ext.rs:46:9] self = Comments {
data: [
Leading {
node: 0: R_CALL@0..71
0: R_IDENTIFIER@0..14
0: IDENT@0..14 "matrix" [Comments("# outer"), Newline("\n")] []
1: R_CALL_ARGUMENTS@14..71
0: L_PAREN@14..15 "(" [] []
1: R_ARGUMENT_LIST@15..69
0: R_ARGUMENT@15..69
0: (empty)
1: R_CALL@15..69
0: R_IDENTIFIER@15..34
0: IDENT@15..34 "c" [Newline("\n"), Whitespace(" "), Comments("# fmt: table"), Newline("\n"), Whitespace(" ")] []
1: R_CALL_ARGUMENTS@34..69
0: L_PAREN@34..35 "(" [] []
1: R_ARGUMENT_LIST@35..65
0: R_ARGUMENT@35..41
0: (empty)
1: R_DOUBLE_VALUE@35..41
0: R_DOUBLE_LITERAL@35..41 "1" [Newline("\n"), Whitespace(" ")] []
1: COMMA@41..42 "," [] []
2: R_ARGUMENT@42..48
0: (empty)
1: R_DOUBLE_VALUE@42..48
0: R_DOUBLE_LITERAL@42..48 "2" [Newline("\n"), Whitespace(" ")] []
3: COMMA@48..49 "," [] []
4: R_ARGUMENT@49..56
0: (empty)
1: R_DOUBLE_VALUE@49..56
0: R_DOUBLE_LITERAL@49..56 "10" [Newline("\n"), Whitespace(" ")] []
5: COMMA@56..57 "," [] []
6: R_ARGUMENT@57..65
0: (empty)
1: R_DOUBLE_VALUE@57..65
0: R_DOUBLE_LITERAL@57..65 "200" [Newline("\n"), Whitespace(" ")] []
2: R_PAREN@65..69 ")" [Newline("\n"), Whitespace(" ")] []
2: R_PAREN@69..71 ")" [Newline("\n")] []
,
comment: SourceComment {
lines_before: 0,
lines_after: 1,
piece: SyntaxTriviaPieceComments(
Comments("# outer"),
),
kind: Line,
formatted: Cell {
value: true,
},
},
},
Leading {
node: 0: R_ARGUMENT@15..69
0: (empty)
1: R_CALL@15..69
0: R_IDENTIFIER@15..34
0: IDENT@15..34 "c" [Newline("\n"), Whitespace(" "), Comments("# fmt: table"), Newline("\n"), Whitespace(" ")] []
1: R_CALL_ARGUMENTS@34..69
0: L_PAREN@34..35 "(" [] []
1: R_ARGUMENT_LIST@35..65
0: R_ARGUMENT@35..41
0: (empty)
1: R_DOUBLE_VALUE@35..41
0: R_DOUBLE_LITERAL@35..41 "1" [Newline("\n"), Whitespace(" ")] []
1: COMMA@41..42 "," [] []
2: R_ARGUMENT@42..48
0: (empty)
1: R_DOUBLE_VALUE@42..48
0: R_DOUBLE_LITERAL@42..48 "2" [Newline("\n"), Whitespace(" ")] []
3: COMMA@48..49 "," [] []
4: R_ARGUMENT@49..56
0: (empty)
1: R_DOUBLE_VALUE@49..56
0: R_DOUBLE_LITERAL@49..56 "10" [Newline("\n"), Whitespace(" ")] []
5: COMMA@56..57 "," [] []
6: R_ARGUMENT@57..65
0: (empty)
1: R_DOUBLE_VALUE@57..65
0: R_DOUBLE_LITERAL@57..65 "200" [Newline("\n"), Whitespace(" ")] []
2: R_PAREN@65..69 ")" [Newline("\n"), Whitespace(" ")] []
,
comment: SourceComment {
lines_before: 1,
lines_after: 1,
piece: SyntaxTriviaPieceComments(
Comments("# fmt: table"),
),
kind: Line,
formatted: Cell {
value: true,
},
},
},
],
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels