Skip to content

Abnormal Indentation for do-while without brace #12972

Open
@XiongDiNanDang

Description

@XiongDiNanDang

Environment

  • OS and Version: Microsoft Windows 10 Professional Edition 10945.5131 (Latest)
  • VS Code Version: 1.95.3 (system setup) (Latest)
  • C/C++ Extension Version: v1.22.11 (Latest)

Bug Summary and Steps to Reproduce

Bug Summary:
Indentation for do-while without brace is wrong.

Steps to reproduce:
Enable vcFormat to format the code, then just write a do-while like:

if (...)
	do
		cout << "Hello World!";
while (...);

Expected behavior:

if (...)
	do
		cout << "Hello World!";
	while (...);

Configuration and Logs

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "compilerPath": "C:\\TDM-GCC-64\\bin\\gcc.exe",
            "cStandard": "c17",
            "cppStandard": "gnu++14",
            "intelliSenseMode": "windows-gcc-x64"
        }
    ],
    "version": 4
}

Other Extensions

Only this extension has been enabled.

Additional context

The key issue is that the compiler does not compile like it looks like.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions