Skip to content

vcFormat incorrectly formatting templated operator() call #11159

Open
@aandrejevas

Description

@aandrejevas

Environment

  • OS and Version: Windows_NT x64 10.0.19045
  • VS Code Version: 1.79.2
  • C/C++ Extension Version: v1.16.3

Bug Summary and Steps to Reproduce

Settings:

"C_Cpp.default.cppStandard": "c++23",
"C_Cpp.default.cStandard": "c17",
"C_Cpp.default.intelliSenseMode": "windows-gcc-x64",
"C_Cpp.default.compilerPath": "C:\msys64\ucrt64\bin\g++.exe",
"C_Cpp.autoAddFileAssociations": false,
"C_Cpp.suggestSnippets": false,
"C_Cpp.formatting": "vcFormat",
"C_Cpp.vcFormat.wrap.preserveBlocks": "allOneLineScopes",
"C_Cpp.vcFormat.indent.gotoLabels": "oneLeft",
"C_Cpp.vcFormat.indent.caseLabels": true,
"C_Cpp.vcFormat.newLine.closeBraceSameLine.emptyFunction": true,
"C_Cpp.vcFormat.newLine.closeBraceSameLine.emptyType": true,
"C_Cpp.vcFormat.indent.multiLineRelativeTo": "statementBegin",
"C_Cpp.vcFormat.newLine.beforeElse": false,
"C_Cpp.vcFormat.newLine.beforeCatch": false,
"C_Cpp.vcFormat.space.withinInitializerListBraces": false,
"C_Cpp.vcFormat.indent.preserveWithinParentheses": true,
"C_Cpp.vcFormat.space.pointerReferenceAlignment": "right",
"C_Cpp.vcpkg.enabled": false,
"C_Cpp.default.defines": [],
"C_Cpp.simplifyStructuredComments": false,
"C_Cpp.errorSquiggles": "disabled",
"C_Cpp.codeAnalysis.runAutomatically": false,
"C_Cpp.dimInactiveRegions": false,
"C_Cpp.intelliSenseEngine": "Tag Parser",
"C_Cpp.vcFormat.indent.lambdaBracesWhenParameter": false

Code before formatting (expected behavior):

#include <functional>

int main() {
	std::less<void> comparator;
	comparator.operator()<int, int>(5, 5);
}

Code after formatting:

#include <functional>

int main() {
	std::less<void> comparator;
	comparator.operator() < int, int > (5, 5);
}

Configuration and Logs

loggingLevel: Debug
loggingLevel has changed to: Debug
LSP: cpptools/textEditorSelectionChange
LSP: textDocument/didOpen: file:///c%3A/Users/Aleksandras/Desktop/projects/QAP_BA/src/format.cpp
LSP: cpptools/activeDocumentChange: file:///c%3A/Users/Aleksandras/Desktop/projects/QAP_BA/src/format.cpp
Checking for syntax errors: C:\Users\Aleksandras\Desktop\projects\QAP_BA\src\format.cpp
LSP: cpptools/getCodeActions: file:///c%3A/Users/Aleksandras/Desktop/projects/QAP_BA/src/format.cpp (id: 634)
LSP: cpptools/getDocumentSymbols: file:///c%3A/Users/Aleksandras/Desktop/projects/QAP_BA/src/format.cpp (id: 635)
Queueing IntelliSense update for files in translation unit of: C:\Users\Aleksandras\Desktop\projects\QAP_BA\src\format.cpp
LSP: cpptools/textEditorSelectionChange
LSP: cpptools/getSemanticTokens: file:///c%3A/Users/Aleksandras/Desktop/projects/QAP_BA/src/format.cpp (id: 636)
LSP: cpptools/getInlayHints: file:///c%3A/Users/Aleksandras/Desktop/projects/QAP_BA/src/format.cpp (id: 637)
Database safe to open.
Error squiggle count: 0
Update IntelliSense time (sec): 0.438
LSP: textDocument/willSaveWaitUntil: file:///c%3A/Users/Aleksandras/Desktop/projects/QAP_BA/src/format.cpp (id: 638)
willSaveWaitUntil: 0ms
LSP: cpptools/formatDocument: file:///c%3A/Users/Aleksandras/Desktop/projects/QAP_BA/src/format.cpp (id: 639)
Formatting document: file:///C%3A/Users/Aleksandras/Desktop/projects/QAP_BA/src/format.cpp
Formatting Engine: vcFormat
LSP: textDocument/didChange: file:///c%3A/Users/Aleksandras/Desktop/projects/QAP_BA/src/format.cpp
LSP: textDocument/didSave: file:///c%3A/Users/Aleksandras/Desktop/projects/QAP_BA/src/format.cpp
  tag parsing file: C:\Users\Aleksandras\Desktop\projects\QAP_BA\src\format.cpp
LSP: cpptools/fileChanged: file:///c%3A/Users/Aleksandras/Desktop/projects/QAP_BA/src/format.cpp
LSP: cpptools/getDocumentSymbols: file:///c%3A/Users/Aleksandras/Desktop/projects/QAP_BA/src/format.cpp (id: 640)
LSP: cpptools/getSemanticTokens: file:///c%3A/Users/Aleksandras/Desktop/projects/QAP_BA/src/format.cpp (id: 641)
LSP: cpptools/getInlayHints: file:///c%3A/Users/Aleksandras/Desktop/projects/QAP_BA/src/format.cpp (id: 642)
idle loop: reparsing the active document
Checking for syntax errors: C:\Users\Aleksandras\Desktop\projects\QAP_BA\src\format.cpp
Queueing IntelliSense update for files in translation unit of: C:\Users\Aleksandras\Desktop\projects\QAP_BA\src\format.cpp
sending 4 changes to server
Error squiggle count: 0
Update IntelliSense time (sec): 0.277
Checking for syntax errors: C:\Users\Aleksandras\Desktop\projects\QAP_BA\src\format.cpp
Queueing IntelliSense update for files in translation unit of: C:\Users\Aleksandras\Desktop\projects\QAP_BA\src\format.cpp
Error squiggle count: 0
Update IntelliSense time (sec): 0.256
LSP: cpptools/getSemanticTokens: file:///c%3A/Users/Aleksandras/Desktop/projects/QAP_BA/src/format.cpp (id: 643)

Other Extensions

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions