microsoft / microsoft/vscode-cpptools

Abnormal Indentation for do-while without brace

オープン
#12,972 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

bug Feature: Code Formatting Language Service Visual Studio
主要言語
TypeScript
スター
6.2k
フォーク
1.7k
平均マージ
14時間 46分
マージ済み PR(30日)
61

説明

Environment
  • OS and Version: Microsoft Windows 10 Professional Edition 10945.5131 (Latest)
  • VS Code Version: 1.95.3 (system setup) (Latest)
  • C/C++ Extension Version: v1.22.11 (Latest)
Bug Summary and Steps to Reproduce

Bug Summary:
Indentation for do-while without brace is wrong.

Steps to reproduce:
Enable vcFormat to format the code, then just write a do-while like:

if (...)
	do
		cout << "Hello World!";
while (...);

Expected behavior:

if (...)
	do
		cout << "Hello World!";
	while (...);
Configuration and Logs
{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "compilerPath": "C:\\TDM-GCC-64\\bin\\gcc.exe",
            "cStandard": "c17",
            "cppStandard": "gnu++14",
            "intelliSenseMode": "windows-gcc-x64"
        }
    ],
    "version": 4
}
Other Extensions

Only this extension has been enabled.

Additional context

The key issue is that the compiler does not compile like it looks like.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、Windows の C/C++ 拡張機能で vcFormat を有効にした状態で例を再現し、実際のインデントと期待される出力を比較します。if の下にネストされた波括弧のない do-while が、while 文を if 本体の内側にインデントした状態でフォーマットされれば、作業は完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
cpp, typescript, vscode
領域
developer-experience, tooling
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。