Code.ps1
$global:code = Join-Path $env:USERPROFILE "scoop/apps/vscode/current/bin/code.cmd" function Install-Code { if (-Not(Get-Command "git" -ErrorAction SilentlyContinue)) { Install-Scoop scoop install git # Git is required for buckets. # TODO add user name, email } if (-Not(Test-Path -Path $global:code -PathType leaf -ErrorAction SilentlyContinue)) { Install-Scoop scoop bucket add extras scoop install vscode } # add image shortcut on desktop Install-CodeExtension "ms-vscode-remote.remote-ssh" Install-CodeExtension "ms-vscode-remote.remote-wsl" Install-CodeExtension "ms-vscode.remote-server" } function Install-CodeExtension { param ( [string] $Name ) $extensions = Invoke-Expression "$global:code --list-extensions" if (-Not($extensions -Contains $Name)) { code --install-extension $Name } } function Update-Code { Install-Code scoop update vscode } function Start-Code { param( [switch] $Browser ) if ($Browser) { Start-Process "https://vscode.dev/" return # [system.Diagnostics.Process]::Start("msedge","https://debug.to") chrome firefox #"Look instructions at https://xtec.dev/dev/vscode/remote/" } Install-Code Invoke-Expression $global:code } |