Have `expandAlias` emit `TextEdit`s like the rename handler instead of a custom request
还没有人认领这个 Issue。
评估
调研方向
从 ExpandAliasHandler、RenameService 和 ScriptExtentAdapter 开始,并以 #2312 和 #2108 作为上下文。跟踪现有的 powerShell/expandAlias 请求和 vscode-powershell 客户端 plumbing,然后比较 rename handler 的 TextEdit 输出。当 alias expansion 为 command-name extents 发出 edits,并且 client contract 得到更新或 custom request 被 deprecated 时,即视为完成。
由索引模型根据 Issue 内容生成。
描述
Follow-on from @JustinGrote's review on #2312: https://github.com/PowerShell/PowerShellEditorServices/pull/2312#pullrequestreview-4521187389
Yeah looks fine to me. As a follow-on issue we should probably update the rename handler to use this same code path if it isn't already.
The rename handler (RenameService) is already on the modern path — it uses System.Management.Automation.Language.Parser.ParseInput plus AST visitors and never used the legacy PsParser, so there's nothing to migrate there. #2312 brought ExpandAliasHandler onto the same modern parser.
The remaining divergence is in output shape, and the reusable direction is the reverse of "rename adopts expand-alias": expand-alias should adopt rename's edit model.
ExpandAliasHandlerresolves aliases, then returns a single wholesale-rewritten string over the custompowerShell/expandAliasJSON-RPC request.RenameServicewalks AST extents and returnsTextEdit[]over standardtextDocument/rename, usingScriptExtentAdapterto map PowerShell 1-based extents to LSP 0-based ranges.
This is also what #2108 itself anticipated: "return a proper edit (potentially deprecating the need for an entirely separate custom request)."
Proposed work:
- Rework alias expansion to emit
TextEdits (reusingScriptExtentAdapter) covering each command-name token's extent, instead of returning a rewritten document. - Investigate folding it into a standard LSP surface (e.g. a code action) and deprecating the custom
powerShell/expandAliasrequest + its client plumbing in vscode-powershell.
Note this changes the client contract, so it needs coordination with the extension — which is why #2312 was scoped to just the parser swap.
Drafted by Copilot (Claude Opus 4.8).
- 主要语言
- 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. 未关闭
PowerShell/PowerShellEditorServices#2331 · 1 个 reaction · 已指派 2 人 ·
-
Area-Debugging Issue-Enhancement
PowerShell/PowerShellEditorServices#2294 · 1 个 reaction · 已指派 2 人 ·
-
Issue-Bug Needs: Triage
难度 4/5 3-5 天 新手友好度 48/100
PowerShell/PowerShellEditorServices#2293 · 1 条评论 ·
-
PowerShell/PowerShellEditorServices#2282 · 1 条评论 · 1 个 reaction · 已指派 2 人 ·
-
Issue-Bug Needs: Triage
PowerShell/PowerShellEditorServices#2278 · 1 个 reaction · 已指派 2 人 ·
查看 PowerShell/PowerShellEditorServices 的全部 Issue
相似的 Issue
-
bug
难度 1/5 1 小时以内 新手友好度 75/100
sillsdev/languageforge-lexbox#2665 ·
-
bug documentation frontend
难度 2/5 1-3 小时 新手友好度 72/100
azurenoops/spin_agent#975 ·
-
难度 2/5 1-3 小时 新手友好度 86/100
-
:watch: Not Triaged 11.0 fundamentals/subsvc
难度 2/5 1-3 小时 新手友好度 92/100
dotnet/AspNetCore.Docs#37699 ·
-
难度 2/5 1-3 小时 新手友好度 72/100
SubtitleEdit/subtitleedit#15108 · 1 条评论 ·