microsoft / microsoft/vscode-cpptools

vcFormat incorrectly formatting templated operator() call

Aperta
#11,159 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

bug Feature: Code Formatting Language Service Visual Studio
Lingua principale
TypeScript
Stelle
6.2k
Fork
1.7k
Merge medio
14h 46m
PR unite (30g)
61

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia dal percorso di formattazione di vcFormat e riproduci la chiamata C++ a operator() segnalata nell’issue, con le impostazioni e l’output prima/dopo. Traccia il modo in cui viene classificata la chiamata con template, quindi verifica che la formattazione preservi la sintassi prevista dell’operatore senza spazi intorno ai suoi argomenti template.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
cpp
Ambito
tooling
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
38/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.