microsoft / microsoft/vscode-cpptools
Wrong or unchanged indentation when initializing structs.
オープン
まだ誰も着手していません。
bug
Feature: Code Formatting
Language Service
Visual Studio
- 主要言語
- TypeScript
- スター
- 6.2k
- フォーク
- 1.7k
- 平均マージ
- 14時間 46分
- マージ済み PR(30日)
- 61
説明
Bug type: Language Service
With VSCode 1.56 (April 2021) & cpptools 1.4.1
There are problems with the indentations of struct initializers.
- When initializing a variable, the indentation is unchanged.
- When returning, the indentation is changed but wrong.
- The first line is correct.
- The rest is double-indented.
typedef struct thing {
int a;
int b;
} thing;
thing get_thing() {
/* In these situations: indentation is unchanged */
thing a = {
10, // wrong indentation not corrected
10 // wrong indentation not corrected
};
thing t = {
.a = 10, // wrong indentation not corrected
.b = 10 // wrong indentation not corrected
};
t = (thing){
.a = 10, // had to manually indent those ones
.b = 10 // indentation is unchanged by formatter
};
/* In these situations: indentation is worng */
return (thing) {
.a = 10, // good
.b = 10 // wrong indentation formatted
};
}
Configuration:
"C_Cpp.formatting": "vcFormat"
"C_Cpp.vcFormat.indent.caseLabels": true
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
C_Cpp.formatting を vcFormat に設定し、記載されているインデント設定を使用して、埋め込まれた C の構造体初期化子の例で問題を再現します。変数の初期化と return 式に対する vcFormat の処理を追跡し、その結果のインデントが例で想定されているレイアウトと一致することを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- c, typescript, vscode
- 領域
- developer-experience, tooling
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100