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
- Enable C# Dev Kit.
- Open a
.cs file in a loaded solution.
- 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:
Actual behavior
Roslyn inserts/reformats braces:
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.
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
Relevant VS Code settings
Relevant .editorconfig settings
Steps to reproduce
.csfile in a loaded solution.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:
Actual behavior
Roslyn inserts/reformats braces:
Isolation performed
registerOnAutoInserthandler processes{and newline changes independently ofeditor.autoClosingBracketsandeditor.formatOnType.{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: falseAlternatively, please add a user setting that disables Roslyn auto-insert for braces and newlines.