PowerShell / PowerShell/PSScriptAnalyzer

Format document converting timestamp within single quotes

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

Chưa có ai nhận issue này.

Area - Formatter Issue - Bug
Ngôn ngữ chính
C#
Star
2.2k
Fork
414
Merge trung bình
13 giờ 1 phút
Pull request đã merge (30 ngày)
2

Mô tả

From @sk82jack on December 14, 2018 0:20

System Details

System Details Output

### VSCode version: 1.30.0 c6e592b2b5770e40a98cb9c2715a8ef89aec3d74 x64

### VSCode extensions:
CoenraadS.bracket-pair-colorizer@1.0.61
eamodio.gitlens@9.2.0
ms-azure-devops.azure-pipelines@1.145.1
ms-python.python@2018.12.0
ms-vscode.csharp@1.17.1
ms-vscode.PowerShell@1.10.1
ms-vsliveshare.vsliveshare@0.3.1013


### PSES version: 1.10.1.0

### PowerShell version:

Name                           Value
----                           -----
PSVersion                      5.1.17763.134
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17763.134
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
Issue Description

When running format document on a script it is converting an ISO 8601 timestamp within a string to a more human-readable string.

The issue has been reproduced by someone in the PowerShell slack and if you want to try and reproduce it yourself then feel free. Script here https://github.com/sk82jack/PSFPL/blob/master/Tests/Private/ConvertTo-FplObject.Tests.ps1#L48

I am trying to copy the timestamp string from line 67 into line 48

Expected Behaviour

I'd expect text in quotes to not be altered.

Actual Behaviour

Probably best described by a gif:
2018-12-11_18-32-28

Once it converts it it then starts being weird and reporting errors that weren't reported before:
2018-12-13_23-45-09

So, if I Ctrl+Z and then format again and then it doesn't convert it but it does remove the single quote from the end of line 48. I think that must be related to the previously reported errors but it still reports errors after removing the quote:
2018-12-13_23-48-57

So, I Ctrl+Z again and try and format again but the integrated console usually crashes at this point.

Attached Logs

VSCodeDiagnosticLogs.zip

Copied from original issue: PowerShell/vscode-powershell#1657

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.

Hướng nghiên cứu

Bắt đầu với việc tái hiện trong Tests/Private/ConvertTo-FplObject.Tests.ps1, đặc biệt là các dòng 48 và 67, rồi tái hiện hành vi thông qua lệnh format document. Theo dõi cách formatter xử lý timestamp ISO 8601 được đặt trong dấu nháy đơn và xác minh rằng văn bản được đặt trong dấu ngoặc kép vẫn không thay đổi, không phát sinh lỗi parse hoặc sự cố treo console.

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

Đánh giá

Công nghệ
powershell
Lĩnh vực
tooling
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
32/100

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.