microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.4k stars 1.51k forks source link

Formatting issues when using doxygen #12056

Open Jinying-Tang opened 4 months ago

Jinying-Tang commented 4 months ago

Environment

When I use doxygen to generate annotations, autoformatting automatically indents the generated @file by one space
bug

Bug Summary and Steps to Reproduce

Bug Summary:

Steps to reproduce:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior:

Configuration and Logs

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "compilerPath": "D:\\Program Files\\msys64\\ucrt64\\bin\\gcc.exe",
            "cStandard": "c17",
            "cppStandard": "gnu++17",
            "intelliSenseMode": "windows-gcc-x64",
            "configurationProvider": "iarsystems.iar-build"
        }
    ],
    "version": 4
}

Other Extensions

No response

Additional context

No response

sean-mcmanus commented 4 months ago

@Jinying-Tang That generated doxygen comment appears to be coming from another extension, maybe GitHub Copilot, see https://github.com/community/community/discussions/categories/copilot .

Jinying-Tang commented 4 months ago

@Jinying-Tang That generated doxygen comment appears to be coming from another extension, maybe GitHub Copilot, see https://github.com/community/community/discussions/categories/copilot .

I'm sure it's a problem with c/c++ code formatting, I don't have copilot installed, but I have Doxygen Documentation Generator installed, and if I disable the c/c++ extension, it shows up correctly bug

sean-mcmanus commented 4 months ago

@Jinying-Tang What formatter settings are being used? If you set C_Cpp.loggingLevel to "Debug" and format -- does the C/C++ logging mention clangFormat or vcFormat. If clangFormat, do you have any clang_format settings set? Does the bug repro if you format document or format on paste with the comment?

Jinying-Tang commented 4 months ago

@Jinying-Tang What formatter settings are being used? If you set C_Cpp.loggingLevel to "Debug" and format -- does the C/C++ logging mention clangFormat or vcFormat. If clangFormat, do you have any clang_format settings set? Does the bug repro if you format document or format on paste?

1、When I enable C/C++ extensions, the @file falls back a space, causing the @author to be out of alignment, and when C/C++ extensions are disabled, the @file is aligned with the @author 2、When I copy the correct formatting content to the beginning of another .c or .h file and save it, @file does not fall back a space

image

sean-mcmanus commented 3 months ago

@Jinying-Tang How do I use Doxygen Documentation Generator to generate the comment? Are there particular settings?

Jinying-Tang commented 3 months ago

@Jinying-Tang How do I use Doxygen Documentation Generator to generate the comment? Are there particular settings?

The Doxygen Documentation Generator does not require any special configuration.

  1. Create a .c or .h file 2.Type /** at the top of the created file, then press enter, and it will automatically generate a comment
starball5 commented 3 months ago

Potentially related on Stack Overflow: How to Fix Casing of Visual Studio Code clang-format Command-Line