Lines unaffected from sytax errors get formatted wrong on PowerShell 5
還沒有人認領這個 Issue。
評估
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 新手友好度
- 35/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 停滯
- 技術堆疊
- powershell
- 領域
- tooling
研究方向
先使用 Invoke-Formatter 和提供的語法錯誤程式碼片段重現 PowerShell 5 的情況,然後追蹤在解析錯誤後處理未受影響行的 formatter 路徑。完成標準是 PowerShell 5 保持斜線附著在參數上,與預期輸出一致,同時不改變現有的 PowerShell 7 行為。
由索引模型根據 Issue 內容生成。
描述
Before submitting a bug report:
- Make sure you are able to repro it on the latest released version
- Perform a quick search for existing issues to check if this bug has already been reported
Steps to reproduce
- Open a PowerShell 5 window
- Type the following code with intentional syntax errors:
$code = @"
@(
@{
""
}
""
)
test /parameter
"@
Invoke-Formatter $code
Expected behavior
Slash should not be seperated from parameter since it isn't affected from the syntax error.
@(
@{
""
}
""
)
test /parameter
Actual behavior
Slash is treated as an operator and is seperated from parameter. This behavior is unique to PowerShell 5 and does not occur in v7.
@(
@{
""
}
""
)
test / parameter
If an unexpected error was thrown then please report the full error details using e.g. $error[0] | Select-Object *
Environment data
> $PSVersionTable
Name Value
---- -----
PSVersion 5.1.19041.1320
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.19041.1320
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
> (Get-Module -ListAvailable PSScriptAnalyzer).Version | ForEach-Object { $_.ToString() }
1.20.0
- 主要語言
- C#
- 星號
- 2.2k
- 分支
- 416
- 平均合併
- 13 小時 1 分鐘
- 30 天內合併 PR
- 2
環境準備
在瀏覽器裡用你自己的 GitHub 帳號啟動這個專案的開發容器。
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
PowerShell/PSScriptAnalyzer 的其他 Issue
-
Up-for-Grabs
難度 1/5 1-3 小時 新手友好度 78/100
PowerShell/PSScriptAnalyzer#2213 · 2 則留言 ·
-
難度 3/5 1-2 天 新手友好度 48/100
PowerShell/PSScriptAnalyzer#2220 ·
-
難度 3/5 1-2 天 新手友好度 55/100
PowerShell/PSScriptAnalyzer#2219 ·
-
難度 3/5 1-2 天 新手友好度 72/100
PowerShell/PSScriptAnalyzer#2218 ·
-
難度 3/5 1-2 天 新手友好度 72/100
PowerShell/PSScriptAnalyzer#2217 · 1 則留言 ·
查看 PowerShell/PSScriptAnalyzer 的全部 Issue
相似的 Issue
-
copilot documentation
難度 1/5 1-3 小時 新手友好度 88/100
維護者通常 2 天內回覆
-
needs-triage
難度 2/5 1-3 小時 新手友好度 84/100
elsa-workflows/elsa-foundation#2290 ·
維護者通常 1 天內回覆
-
python triage
難度 2/5 1-3 小時 新手友好度 84/100
microsoft/semantic-kernel#14522 ·
維護者通常 4 天內回覆
-
area-integrations needs-area-label triage:bot-seen triage:needs-human
難度 2/5 1-3 小時 新手友好度 84/100
microsoft/aspire#20652 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 68/100
agoda-com/Shouldly.FromAssert#40 ·
維護者通常 1 天內回覆