Add support for renaming PowerShell class references
還沒有人認領這個 Issue。
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 48/100
研究方向
首先重現兩個類別範例,並在類別名稱參照上按下 F2。追蹤 PowerShell Editor Services 中現有的重新命名處理,包括同一檔案中的類別參照,以及可選 Attribute 後綴的行為。完成的標準是:重新命名會一致地更新宣告、建構函式、型別參照和屬性使用方式。
由索引模型根據 Issue 內容生成。
描述
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 PowerShell Editor Services itself and does not reproduce in a standalone PowerShell instance, and is not an issue with my editor.
- I have verified that I am using the latest version of PowerShell Editor Services.
- If this is a security issue, I have read the security issue reporting guidance.
Summary
This is not a bug, but the README says that rename scenarios should be filed as bug reports, so that's what I'm doing.
I think it should be fairly trivial to add renaming support for PowerShell classes defined in the same script file.
Expected:
class DemoClass
{
[string] $SomeProperty
DemoClass ([string] $SomeArg)
{
$this.SomeProperty = $SomeArg
}
}
[DemoClass]
Actual:
class NewName
{
[string] $SomeProperty
NewName ([string] $SomeArg)
{
$this.SomeProperty = $SomeArg
}
}
[NewName]
One thing to keep in mind during implementation is that a PowerShell class can also be used to define an attribute, and an attribute type can drop the optional Attribute suffix in an attribute context as seen here:
class ValidateSomethingAttribute : System.Management.Automation.ValidateArgumentsAttribute
{
[void]Validate([System.Object]$arguments, [System.Management.Automation.EngineIntrinsics]$engineIntrinsics)
{
}
}
[ValidateSomething()][string]$Path = "c:\windows"
PowerShell Version
Name Value
---- -----
PSVersion 7.6.1
PSEdition Core
GitCommitId 7.6.1
OS Microsoft Windows 10.0.26200
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.4
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Editor Version
VS code:
Version: 1.117.0 (system setup)
Commit: 10c8e557c8b9f9ed0a87f61f1c9a44bde731c409
Date: 2026-04-21T16:12:14-07:00
Electron: 39.8.7
ElectronBuildId: 13841579
Chromium: 142.0.7444.265
Node.js: 22.22.1
V8: 14.2.231.22-electron.0
OS: Windows_NT x64 10.0.26200
PowerShell Editor Services Version
Major Minor Build Revision
----- ----- ----- --------
4 6 0 0
Steps to Reproduce
Use the code blocks from before and press F2 on the class name references.
Visuals
No response
Logs
No response
- 主要語言
- C#
- 星號
- 767
- 分支
- 266
- 平均合併
- 3 天 16 小時
- 30 天內合併 PR
- 1
環境準備
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
PowerShell/PowerShellEditorServices 的其他 Issue
-
[Bug] None of the string overloads of `EditorExtensionServiceProvider.GetService()` work on .NET.可能重新可做 @andyleejordan 於 94 天前認領,目前沒有進行中的 PR。 未關閉
PowerShell/PowerShellEditorServices#2331 · 1 個 reaction · 已指派 2 人 ·
-
Area-Language Server Issue-Enhancement
難度 4/5 3-5 天 新手友好度 48/100
PowerShell/PowerShellEditorServices#2315 · 1 則留言 ·
-
Improve Constrained Runspace Debug Experience可能已有人在做 @JustinGrote 於 117 天前認領。 未關閉Area-Debugging Issue-Enhancement
PowerShell/PowerShellEditorServices#2294 · 1 個 reaction · 已指派 2 人 ·
-
Document outline drops child variables when a function/filter reuses a variable name declared earlier (scope-blind declaration dedup)可能已有人在做 @JustinGrote 於 145 天前認領。 未關閉
PowerShell/PowerShellEditorServices#2282 · 1 則留言 · 1 個 reaction · 已指派 2 人 ·
-
PsesDocumentHighlightHandler debug log doesn't display list contents.可能已有人在做 @JustinGrote 於 167 天前認領。 未關閉Issue-Bug Needs: Triage
PowerShell/PowerShellEditorServices#2278 · 1 個 reaction · 已指派 2 人 ·
查看 PowerShell/PowerShellEditorServices 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 62/100
builtbybel/CrapFixer#112 ·
-
area-ai untriaged
難度 2/5 1-3 小時 新手友好度 85/100
dotnet/extensions#7790 ·
維護者通常 1 天內回覆
-
Beginner Friendly T: Bugfix
難度 2/5 1-3 小時 新手友好度 82/100
space-wizards/space-station-14#46220 ·
維護者通常 1 天內回覆
-
P2 testing
難度 1/5 1 小時以內 新手友好度 90/100
維護者通常 1 天內回覆
-
area-Infrastructure-coreclr os-ios os-maccatalyst os-tvos untriaged
難度 2/5 1-3 小時 新手友好度 78/100
dotnet/runtime#134766 · 3 則留言 ·
維護者通常 1 天內回覆