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

C_Cpp>Vc Format>Indent:Preprocessor Setting Not Applied in Nested Scenarios #11428

Open
TwoBrushes opened this issue Sep 12, 2023 · 5 comments
Open

Comments

@TwoBrushes
Copy link

Environment

  • OS and Version: Windows11 22H2
  • VS Code Version: 1.82.0
  • C/C++ Extension Version: v1.17.5
  • If using SSH remote, specify OS of remote machine:

Bug Summary and Steps to Reproduce

1、when i set C_Cpp>Vc Format>Indent:Preprocessor to "none", but the Preprocessor(#define , #include...) always set to "leftmostcolumn"

2、When I use Doxygen to generate comments, the second line will automatically indent by one space.
image

3、how can i define the auto indent format like this?
image

Configuration and Logs

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "cStandard": "c17",
            "cppStandard": "c++17",
            "intelliSenseMode": "windows-msvc-x64"
        }
    ],
    "version": 4
}

Other Extensions

No response

Additional context

No response

@browntarik
Copy link
Contributor

Thank you for submitting your issue! To address your concerns in order:

  1. Based on my testing, it looks like this feature is working as intended. In order to accurately test your setup, I would like you to test your settings on a simple .cpp file using this example:
class MyClass
{
    void Function()
    {
        #if DEBUG
        DebugPrint();
        #endif
    }
}

If you find the same issues, please let me know.

  1. This is intended behavior as doxygen comments are meant to be a formalized documentation style. If you would like to submit a feature request to be able to edit the indentation, please submit one here: https://github.com/microsoft/vscode-cpptools/issues/new?assignees=&labels=&projects=&template=3_feature-request.yml

  2. See response 1 to ensure your settings are working correctly or to confirm there is a bug that needs to be fixed.

@browntarik browntarik self-assigned this Sep 13, 2023
@browntarik browntarik added more info needed The issue report is not actionable in its current state Language Service labels Sep 13, 2023
@TwoBrushes
Copy link
Author

TwoBrushes commented Sep 13, 2023

Thank you for submitting your issue! To address your concerns in order:

  1. Based on my testing, it looks like this feature is working as intended. In order to accurately test your setup, I would like you to test your settings on a simple .cpp file using this example:
class MyClass
{
    void Function()
    {
        #if DEBUG
        DebugPrint();
        #endif
    }
}

If you find the same issues, please let me know.

class MyClass
{
    void Function()
    {
        #if DEBUG
        DebugPrint();
        #endif
    }
}

is working as intended, but

                                                #if TEST
class MyClass
{
   void Function()
   {
       #if DEBUG
       DebugPrint();
       #endif
   }
}
#endif

#if TEST will "leftmostcolumn"

@TwoBrushes
Copy link
Author

2. This is intended behavior as doxygen comments are meant to be a formalized documentation style. If you would like to submit a feature request to be able to edit the indentation, please submit one here: https://github.com/microsoft/vscode-cpptools/issues/new?assignees=&labels=&projects=&template=3_feature-request.yml

image

On the second line of the comment, @file has moved back one space, causing misalignment with @author below. I disabled the c/c++ extension and now it aligns correctly.

@browntarik
Copy link
Contributor

Thank you for clarifying these scenarios, there is indeed a bug with preprocessor formatting in nested scenarios that our team will take a look at. I will further investigate the issue with doxygen formatting to verify if further action needs to be taken.

@browntarik browntarik added bug Feature: Code Formatting and removed more info needed The issue report is not actionable in its current state labels Sep 13, 2023
@browntarik browntarik changed the title C_Cpp>Vc Format>Indent:Preprocessor C_Cpp>Vc Format>Indent:Preprocessor Setting Not Applied in Nested Scenarios Sep 13, 2023
@browntarik browntarik added this to Triage in 1.18 via automation Sep 14, 2023
@browntarik browntarik modified the milestones: On Deck, 1.18 Sep 14, 2023
@browntarik
Copy link
Contributor

browntarik commented Sep 14, 2023

@TwoBrushes the bug with preprocessor statements has been filed with our Visual Studio team (Internal Bug Number: 1885941). Please use this GitHub issue to keep track of when a fix for this issue has been addressed.

Thank you!

@browntarik browntarik modified the milestones: 1.18, Tracking Sep 14, 2023
@bobbrow bobbrow removed this from Triage in 1.18 Nov 6, 2023
@bobbrow bobbrow added this to Triage in 1.19 via automation Nov 6, 2023
@browntarik browntarik removed their assignment Nov 14, 2023
@bobbrow bobbrow removed this from Triage in 1.19 Jan 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants