C# Dev Kit auto-insert ignores editor.autoClosingBrackets and editor.formatOnType
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 65/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- csharp, typescript, vscode
- Lĩnh vực
- developer-experience, devtools
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
.csfile 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:
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
registerOnAutoInserthandler processes{and newline changes independently ofeditor.autoClosingBracketsandeditor.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.
- Ngôn ngữ chính
- TypeScript
- Star
- 3.1k
- Fork
- 738
- Merge trung bình
- 21 giờ 21 phút
- Pull request đã merge (30 ngày)
- 42
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của dotnet/vscode-csharp
-
Infrastructure Test
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
dotnet/vscode-csharp#9791 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
C# crashĐang mởBug C#DK Needs More Info Reliability Remote Extensions Roslyn LSP
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
dotnet/vscode-csharp#9807 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Bug Debugger
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
dotnet/vscode-csharp#9802 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
untriaged
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 58/100
dotnet/vscode-csharp#9787 · 6 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
C# Dev Kit writes an untracked runfile-discovery cache into the workspaceCó thể đã có người làm @RikkiGibson đã nhận 15 ngày trước. Đang mởBug Feature - Run File
dotnet/vscode-csharp#9767 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của dotnet/vscode-csharp
Issue tương tự
-
bug via-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
pingdotgg/t3code#14452 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
solana-foundation/program-examples#747 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 9 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
remotion-dev/remotion#11847 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
openwatersio/slackwater#355 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
melgarafael/DeskcommCRM#1998 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày