Created
May 13, 2016 15:33
-
-
Save gerane/f6b80bbe19c66b0b9de688fd23ea14a4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-CommandChoice | |
{ | |
[CmdletBinding()] | |
param | |
( | |
[Parameter(Mandatory=$true)] | |
[Array]$Array, | |
[Parameter(Mandatory=$true)] | |
[string]$caption, | |
[Parameter(Mandatory=$true)] | |
[string]$Message, | |
[int]$DefaultChoice = 0 | |
) | |
$Choices = [System.Management.Automation.Host.ChoiceDescription[]] @($Array) | |
$Choice = $host.ui.PromptForChoice($Caption,$Message, $Choices,$DefaultChoice) | |
Return $Array[$Choice] | |
} | |
function Invoke-TestCommand { | |
$Extensions = Get-Childitem -path "$Env:USERPROFILE\.vscode-insiders\extensions\gerane*" -Directory | |
$Caption = "Please select a an Extension" | |
$Message = "Package.json will be launched" | |
$CommandChoice = Get-CommandChoice -Array $Extensions.Name -caption $Caption -Message $Message | |
$Package = "$Env:USERPROFILE\.vscode-insiders\extensions\$CommandChoice\package.json" | |
$psEditor.Workspace.OpenFile($Package) | |
} | |
Register-EditorCommand ` | |
-Name "MyModule.OpenExtPackageJson" ` | |
-DisplayName "Open Extension Package.json" ` | |
-Function Invoke-TestCommand | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment