Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

C# Dev Kit auto-insert ignores editor.autoClosingBrackets and editor.formatOnType

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

メンテナーはふだん 1 日以内に返信

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

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
65/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
csharp, typescript, vscode

調査の方向性

Look at the C# extension's auto-insert handler registration, likely in the TypeScript source. The issue mentions a registerOnAutoInsert handler that processes { and newline. Find where this handler is defined and how it reads VS Code settings like editor.autoClosingBrackets and editor.formatOnType. Test changes by disabling the handler's brace insertion when those settings are 'never' and false. Verify the fix works with C# Dev Kit enabled and doesn't break other formatting.

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

説明

Editor-Formatting Resolved-Configuration Issue

Summary

With C# Dev Kit enabled, typing { and pressing Enter in a C# file automatically inserts/indents a closing } and moves the opening { to its own line.

This happens despite C# auto-closing and format-on-type being explicitly disabled.

Disabling C# Dev Kit stops the behavior, but Visual Studio Tools for Unity depends on C# Dev Kit.

Environment

  • VS Code: 1.139.0
  • C# Dev Kit: 3.40.204
  • C#: 2.160.4
  • .NET Install Tool: 3.2.0
  • Visual Studio Tools for Unity: 1.3.1
  • OS: Windows

Relevant VS Code settings

"editor.autoClosingBrackets": "never",
"editor.autoIndent": "keep",
"editor.formatOnType": false,
"[csharp]": {
  "editor.formatOnType": false,
  "editor.formatOnSave": false,
  "editor.formatOnPaste": false,
  "editor.autoClosingBrackets": "never"
},
"csharp.format.enable": false

Relevant .editorconfig settings

[*.cs]
csharp_new_line_before_open_brace = none
csharp_indent_braces = false

Steps to reproduce

  1. Enable C# Dev Kit.
  2. Open a .cs file in a loaded solution.
  3. Type void Foo() { and press Enter.

Expected behavior

The opening brace remains on the same line, no closing brace is inserted, and normal indentation is preserved:

void Foo() {
    |

Actual behavior

Roslyn inserts/reformats braces:

void Foo()
{
    |
}

Isolation performed

  • Reloading VS Code with extensions disabled stops the behavior.
  • Disabling C# Dev Kit alone stops the behavior.
  • The C# extension’s registerOnAutoInsert handler processes { and newline changes independently of editor.autoClosingBrackets and editor.formatOnType.
  • Filtering { and newline from that handler locally fixes the issue while keeping C# Dev Kit and Visual Studio Tools for Unity enabled.

Requested behavior

Please make Roslyn auto-insert honor:

  • editor.autoClosingBrackets: "never"
  • editor.formatOnType: false

Alternatively, please add a user setting that disables Roslyn auto-insert for braces and newlines.

主要言語
TypeScript
スター
3.1k
フォーク
736
平均マージ
21時間 21分
マージ済み PR(30日)
42

環境構築

はじめの一歩

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

dotnet/vscode-csharp のほかの issue

dotnet/vscode-csharp の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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