Skip to content

1.22.2: No Formatting when extracting to function #12677

Closed
@AlexandraKemperMS

Description

@AlexandraKemperMS

Environment

  • OS and Version: Mac and Windows
  • VS Code Version: 1.92.2
  • C/C++ Extension Version: custom vsix v1.22.0-copilot

Bug Summary and Steps to Reproduce

Bug Summary: When using extract to function, it correctly creates a new function and replaces the selected code with the function call. However, when the declaration of that function is added to the header file, it is not indented as it should be. The generated function is formatted correctly, its only the declaration in the header that is an issue.

Steps to reproduce:

  1. Have a source and header file with multiple functions
  2. Select a section to extract
  3. When it opens the header file, the function name is not indented as it should be

Expected behavior: Format function declaration

image

Configuration and Logs

-------- Diagnostics - 9/3/2024, 2:42:10 PM
Version: 1.22.0-copilot
Current Configuration:
{
    "name": "Win32",
    "includePath": [
        "c:/Github/Cpp-Copilot-VSC-Demo/**",
        "C:/dev/vcpkg/installed/x86-windows/include"
    ],
    "defines": [
        "_DEBUG",
        "UNICODE",
        "_UNICODE"
    ],
    "windowsSdkVersion": "10.0.22621.0",
    "cStandard": "c17",
    "cppStandard": "c++17",
    "intelliSenseMode": "windows-msvc-x64",
    "intelliSenseModeIsExplicit": false,
    "cStandardIsExplicit": false,
    "cppStandardIsExplicit": false,
    "mergeConfigurations": false,
    "compilerPath": "C:\\msys64\\mingw64\\bin\\g++.exe",
    "compilerPathIsExplicit": true,
    "browse": {
        "path": [
            "c:/Github/Cpp-Copilot-VSC-Demo/**",
            "C:/dev/vcpkg/installed/x86-windows/include",
            "${workspaceFolder}"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
cpptools version (native): 1.22.0.0
Translation Unit Mappings:
[ C:\Github\Cpp-Copilot-VSC-Demo\src\calculator.cpp - source TU]:
    C:\Github\Cpp-Copilot-VSC-Demo\src\Calculator.h
Translation Unit Configurations:
[ C:\Github\Cpp-Copilot-VSC-Demo\src\calculator.cpp ]
    Process ID: 11520
    Memory Usage: 120 MB
    Compiler Path: C:\msys64\mingw64\bin\g++.exe
    Includes:
        C:\dev\vcpkg\installed\x86-windows\include
        C:\Github\Cpp-Copilot-VSC-Demo
        C:\Github\Cpp-Copilot-VSC-Demo\src
    System Includes:
        C:\msys64\mingw64\include\c++\12.1.0
        C:\msys64\mingw64\include\c++\12.1.0\x86_64-w64-mingw32
        C:\msys64\mingw64\include\c++\12.1.0\backward
        C:\msys64\mingw64\lib\gcc\x86_64-w64-mingw32\12.1.0\include
        C:\msys64\mingw64\include
        C:\msys64\mingw64\lib\gcc\x86_64-w64-mingw32\12.1.0\include-fixed
    Defines:
        _DEBUG
        UNICODE
        _UNICODE
    Standard Version: c++17
    IntelliSense Mode: windows-gcc-x64
    Other Flags:
        --g++
        --gnu_version=120100
Total Memory Usage: 120 MB

------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 3465
Number of files parsed: 398

Other Extensions

No response

Additional context

No response

Metadata

Metadata

Assignees

Labels

Feature: Code FormattingFeature: Extract to functionExtract to function (free function or member function)Language ServicebugfixedCheck the Milestone for the release in which the fix is or will be available.regressionA bug that didn't exist in a previous release

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions