Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Reports Missing closing '}' on a if statement when not all on one line or the { not on the next line with powershell version 5

Đang mở
#5,297 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

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
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
powershell, typescript

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện ba cách bố trí dấu ngoặc nhọn trong issue bằng PowerShell 5.1 thông qua extension VS Code, sau đó so sánh các chẩn đoán với PowerShell 7. issue được xem là hoàn tất khi dạng nhiều dòng hợp lệ không còn báo thiếu dấu ngoặc nhọn đóng, trong khi các dạng hiện đang hoạt động vẫn hợp lệ.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Issue-Bug Needs: Triage
Prerequisites
  • I have written a descriptive issue title.
  • I have searched all open and closed issues to ensure it has not already been reported.
  • I have read the troubleshooting guide.
  • I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
  • I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
  • If this is a security issue, I have read the security issue reporting guidance.
Summary

When running the following simple script:
`$ben = $true

if ($ben) {
Write-Output "ben"
}
`

the extension throws this error:

Missing closing '}' in statement block or type definition.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : MissingEndCurlyBrace

if the script looks like this:
`$ben = $true

if ($ben)
{
Write-Output "ben"
}`

or this:
`$ben = $true

if ($ben) { Write-Output "ben" }
`

it works.
Or if I switch to version 7 of powershell.

PowerShell Version
Name                           Value                                                                                   
----                           -----                                                                                   
PSVersion                      5.1.26100.6584                                                                          
PSEdition                      Desktop                                                                                 
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                 
BuildVersion                   10.0.26100.6584                                                                         
CLRVersion                     4.0.30319.42000                                                                         
WSManStackVersion              3.0                                                                                     
PSRemotingProtocolVersion      2.3                                                                                     
SerializationVersion           1.1.0.1
Visual Studio Code Version
1.105.1
x64
Extension Version
ms-vscode.powershell@2025.4.0
Steps to Reproduce

see description

Visuals

No response

Logs

No logs

Image

Log level set to trace:

Image

found these
ms-vscode.powershell.zip

Ngôn ngữ chính
TypeScript
Star
1.9k
Fork
548
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của PowerShell/vscode-powershell

Tất cả issue của PowerShell/vscode-powershell

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.