PowerShell / PowerShellEditorServices

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

Add the ability to use either `.` or `&` when launching script #2177

Closed LucasArona closed 1 month ago

LucasArona commented 2 months ago

Add support to change how the scripts are launched (DotSource vs Call operator).

PR Summary

Adds the ExecuteMode property and the corresponding method to either use the DotSource operator or the Call operator when launching scripts.

Related to this PR: https://github.com/PowerShell/vscode-powershell/pull/5036 https://github.com/PowerShell/vscode-powershell/pull/5059

PR Context

See https://github.com/PowerShell/vscode-powershell/issues/4327

It's not always desirable to alter the current scope, this PR allows the use of the Call operator when launching scripts.

andyleejordan commented 1 month ago

@LucasArona I added a unit test for this too. About to merge if it all passes.