microsoft / microsoft/vscode-cpptools
vcFormat incorrectly formatting templates with lambda parameters
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 1.7k
- Avg merge
- 14h 46m
- Merged PRs (30d)
- 61
Description
Environment
- OS and Version: Windows_NT x64 10.0.19045
- VS Code Version: 1.79.2
- C/C++ Extension Version: v1.16.1
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.loggingLevel": "Information",
"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
Expected behavior:
using lambda1 = std::type_identity_t<[] {}>;
template<class T>
using lambda2 = []<size_t> -> T { return {}; };
After formatting:
using lambda1 = std::type_identity_t < [] {} > ;
template<class T>
using lambda2 = []<size_t>->T { return {}; };
Configuration and Logs
-------- Diagnostics - 6/21/2023, 2:06:19 AM
Version: 1.16.1
Current Configuration:
{
"name": "Win32",
"includePath": [
"c:\\Users\\Aleksandras\\Desktop\\programming\\Solutions\\QAP_BA/**"
],
"windowsSdkVersion": "10.0.19041.0",
"defines": [],
"cStandard": "c17",
"cppStandard": "c++23",
"intelliSenseMode": "windows-gcc-x64",
"intelliSenseModeIsExplicit": true,
"cStandardIsExplicit": true,
"cppStandardIsExplicit": true,
"mergeConfigurations": false,
"compilerPath": "C:\\msys64\\ucrt64\\bin\\g++.exe",
"compilerPathIsExplicit": true,
"browse": {
"path": [
"${workspaceFolder}/**"
],
"limitSymbolsToIncludedHeaders": true
}
}
cpptools version (native): 1.16.1.0
No active translation units.
------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 35090
Number of files parsed: 6811
Other Extensions
No response
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names the vcFormat formatter but no source file or test path; start by reproducing the supplied C++23 snippets with the listed formatting settings. Trace vcFormat handling of lambda parameters and template syntax, then verify the formatted output preserves the expected spacing and syntax.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, vscode
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100