Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abnormal Indentation for do-while without brace #12972

Open
XiongDiNanDang opened this issue Nov 18, 2024 · 1 comment
Open

Abnormal Indentation for do-while without brace #12972

XiongDiNanDang opened this issue Nov 18, 2024 · 1 comment

Comments

@XiongDiNanDang
Copy link

XiongDiNanDang commented Nov 18, 2024

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.

@sean-mcmanus
Copy link
Contributor

@XiongDiNanDang I've filed a bug on our shared VS implementation at https://developercommunity.visualstudio.com/t/C-formatting-doesnt-correctly-handle/10793135 . The issue doesn't repro with the clang-format formatter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

2 participants