PowerShellEditorServices icon indicating copy to clipboard operation
PowerShellEditorServices copied to clipboard

Update `ExpandAliasHandler` to use latest PowerShell parser

Open andyleejordan opened this issue 2 years ago • 3 comments

Prerequisites

  • [X] I have written a descriptive issue title.
  • [X] I have searched all issues to ensure it has not already been requested.

Summary

In the following code we (repeatedly) define an internal PowerShell script that uses the original parser to expand the alias.

https://github.com/PowerShell/PowerShellEditorServices/blob/37f0648ca28358c1fd2d0688801658948f69090d/src/PowerShellEditorServices/Services/PowerShell/Handlers/ExpandAliasHandler.cs#L32-L71

Proposed Design

This should be updated to use the new parser directly from the PowerShell APIs in C# and return a proper edit (potentially deprecating the need for an entirely separate custom request).

andyleejordan avatar Dec 05 '23 19:12 andyleejordan

FYI @SeeminglyScience

andyleejordan avatar Dec 05 '23 20:12 andyleejordan

Actually, are we certain that useLocalScope is defaulting to true? I was looking at the code and that doesn't appear to be the case. The second argument is isScript.

andyleejordan avatar Dec 05 '23 20:12 andyleejordan

Related https://github.com/PowerShell/vscode-powershell/issues/338

andyleejordan avatar Feb 22 '24 18:02 andyleejordan