PowerShell / PowerShellEditorServices

A common platform for PowerShell development support in any editor or application!
MIT License
612 stars 207 forks source link

Update `ExpandAliasHandler` to use latest PowerShell parser #2108

Open andyleejordan opened 7 months ago

andyleejordan commented 7 months ago

Prerequisites

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 commented 7 months ago

FYI @SeeminglyScience

andyleejordan commented 7 months ago

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 commented 4 months ago

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