Skip to content

vfmt breaks the new attributes syntax #26766

Description

@gechandesu

Describe the bug

Running v fmt on file replaces the new attributes syntax with old one.

Reproduction Steps

module main

@[
	xml(
		name: 'foo',
		prefix: 'f',
		namespace: 'https://example.com/xmlns/foo'
	)
]
struct Foo {}

@[deprecated(msg: 'use bar() instead', after: '2026-06-01')]
fn foo() {}

fn main() {
	$for attr in Foo.attributes {
		eprintln('struct Foo: ${attr}')
	}
	$for attr in foo.attributes {
		eprintln('fn foo: ${attr}')
	}
}

Expected Behavior

Nothing changed after v fmt file.v.

Current Behavior

module main

@[xml_namespace: 'https://example.com/xmlns/foo']
@[xml_name: 'foo']
@[xml_prefix: 'f']
@[xml]
struct Foo {}

@[deprecated: 'use bar() instead']
@[deprecated_after: '2026-06-01']
fn foo() {}

fn main() {
	$for attr in Foo.attributes {
		eprintln('struct Foo: ${attr}')
	}
	$for attr in foo.attributes {
		eprintln('fn foo: ${attr}')
	}
}

Possible Solution

No response

Additional Information/Context

No response

V version

V 0.5.1 1a32401

Environment details (OS name and version, etc.)

V full version V 0.5.1 4dc97d9.1a32401
OS linux, Linux version 6.18.13-arch1-1 (linux@archlinux) (gcc (GCC) 15.2.1 20260209, GNU ld (GNU Binutils) 2.46) #1 SMP PREEMPT_DYNAMIC Wed, 25 Feb 2026 23:12:35 +0000
Processor 16 cpus, 64bit, little endian, 12th Gen Intel(R) Core(TM) i5-1240P
Memory 0.88GB/15.34GB
V executable /home/ge/.vlang/v
V last modified time 2026-03-25 10:16:18
V home dir OK, value: /home/ge/.vlang
VMODULES OK, value: /home/ge/.vmodules
VTMP OK, value: /tmp/v_1000
Current working dir OK, value: /tmp
Git version git version 2.53.0
V git status weekly.2026.03-573-g1a324019
.git/config present true
cc version cc (GCC) 15.2.1 20260209
gcc version gcc (GCC) 15.2.1 20260209
clang version clang version 21.1.8
tcc version tcc version 0.9.28rc 2025-02-13 HEAD@f8bd136d (x86_64 Linux)
tcc git status thirdparty-linux-amd64 696c1d84
emcc version N/A
glibc version ldd (GNU libc) 2.43

Note

You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugThis tag is applied to issues which reports bugs.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions