microsoft / microsoft/vscode-cpptools
Code folding with `//#region` and `//#endregion`
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 6.2k
- Forks
- 1.7k
- Ø Merge
- 14 Std. 46 Min.
- Gemergte PRs (30 T.)
- 61
Beschreibung
Type: Feature Request
Please make //#region and //#endregion folding available on VSCode for C/C++ too.
Feature request suggested by @Colengms in https://github.com/microsoft/vscode/issues/123016#issuecomment-837074185_
The documentation describes that C/C++ region should be defined with #pragma region and #pragma endregion, although many C/C++ application complain about unknown pragma, generating many warnings. In the very same documentation, the default for many languages is //#region and //#endregion which is definitely the very best choice for C/C++. There are VS Code extensions like this that try to fix these annoying issue, but they create other problems, since single line comments should never use /* */, it makes harder to comment out a block with regions inside.
- Using
#pragma regionalmost always require to disable unknown pragmas with the compiler flag-Wno-unknown-pragmas, which may hide useful warnings such as the typo#pragma ocne. - GCC is one of the most famous compiler, and still there are recently complaining about the need to disable unknown pragmas in order to use
#pragma region. - There are even cases of compilations bugs with the use of
#pragma regionsuch as this. Which would never happen if//#regionwould be a default. - The number of people trying to find workarounds are getting ridiculous at this point, there are people even using
#ifndef MY_REGION_NAME...#endif, which may lead to pieces of code being ignored by the compiler if the region is a duplicate name. - This issue uses an example of C/C++ where it tries the intuitive region folding (
#regioninside line comment), but VSCode fails to fold, since#pragma regionshould have been used instead.
VS Code version: Code 1.55.2 (3c4e3df, 2021-04-13T09:35:57.887Z)
OS version: Windows_NT x64 6.1.7601
ms-vscode.cpptools Version 1.3.1: April 19, 2021
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit der C/C++-Faltungsunterstützung in der Extension und vergleiche deren Behandlung mit der in der VS Code codebasics-Dokumentation beschriebenen Regionssyntax und den verknüpften Faltungsbeispielen. Als erledigt gilt die Aufgabe, wenn //#region und //#endregion für C/C++ korrekt gefaltet werden, ohne dass #pragma-Direktiven erforderlich sind, und das Verhalten in der Extension verifiziert wurde.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- cpp, typescript
- Bereich
- tooling
- Issue-Typ
- Feature
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 48/100