Describe the bug
v fmt will remove comments between map fields in an enum-key map initialization.
Expected Behavior
Comments are preserved.
Current Behavior
Comments are removed.
Reproduction Steps
Format the following code
enum HttpHeader {
user_agent
referer
}
headers := {
HttpHeader.user_agent: 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36'
// content_length: '17' // <-- will be deleted
.referer: 'wwww.google.com'
// content_length: '17' // <-- won't be deleted
}
Possible Solution
No response
Additional Information/Context
I couldn't fully isolate it but maybe that's a start:
"In-Between" comments are not contained in containers__map_init() anymore:
|
comments << p.eat_comments() |
While the same comments are still present in the related parser__eat_comments() fn:
V version
0.3.4
Environment details (OS name and version, etc.)
linux,arch;amd64
Describe the bug
v fmtwill remove comments between map fields in an enum-key map initialization.Expected Behavior
Comments are preserved.
Current Behavior
Comments are removed.
Reproduction Steps
Format the following code
Possible Solution
No response
Additional Information/Context
I couldn't fully isolate it but maybe that's a start:
"In-Between" comments are not contained in
containers__map_init()anymore:v/vlib/v/parser/containers.v
Line 211 in c1e302a
While the same comments are still present in the related
parser__eat_comments()fn:v/vlib/v/parser/parser.v
Line 914 in c1e302a
V version
0.3.4
Environment details (OS name and version, etc.)
linux,arch;amd64