Skip to content

Instantly share code, notes, and snippets.

@jkavanagh58
Created August 12, 2018 13:17
Show Gist options
  • Save jkavanagh58/42ff368aad5a9e09f6061d8ab0b53ce5 to your computer and use it in GitHub Desktop.
Save jkavanagh58/42ff368aad5a9e09f6061d8ab0b53ce5 to your computer and use it in GitHub Desktop.
<#
.SYNOPSIS
Installs base VSCode Extensions
.DESCRIPTION
Uses list of recommended extensions to start using VSCode with PowerShell.
.NOTES
===========================================================================
Created with: Visual Studio Code
Created on: 08.12.2018
Created by: Kavanagh, John J.
Organization: TEKSystems
Filename: Add-VSCodeExtension
===========================================================================
08.12.2018 JJK: Assembling list of VSCode extensions to help get a user started
with VSCode and PowerShell
08.12.2018 JJK: TODO: Research the availability of code.cmd as it has not been existent
even after successful installation.
#>
Function Add-VSCodeExtension {
[CmdletBinding()]
Param (
[parameter(Mandatory=$False, ValueFromPipeline=$False,
HelpMessage = "Collection of Recommended Extensions")]
[System.Collections.ArrayList]$extList
)
BEGIN {
If (get-command -Name code.cmd -ErrorAction SilentlyContinue){
# Build list of extensions
$extList = New-Object System.Collections.ArrayList
$extList.Add("gerane.Theme-Blackboard") | Out-Null
$extList.Add("docsmsft.docs-markdown") | Out-Null
$extList.Add("DougFinke.vscode-PSStackoverflow") | Out-Null
$extList.Add("fabiospampinato.vscode-todo-plus") | Out-Null
$extList.Add("ms-vsts.team") | Out-Null
$extList.Add("nobuhito.printcode") | Out-Null
$extList.Add("wayou.vscode-todo-highlight") | Out-Null
}
Else {
"Unable to find the command needed to perform this operation."
}
}
PROCESS {
ForEach ($extension in $extList){
& code --install-extension $extension
}
}
END {
Remove-Variable -Name extList
[System.GC]::Collect()
}
} # end Add-VSCodeExtension Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment