Code.ps1


function Install-CodeExtension {
  param (
    [string] $Name
  )

  $extensions = code --list-extensions
  if (-Not($extensions -Contains $Name)) {
    code --install-extension $Name
  }
}

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/"
  }

  if (-Not(Get-Command "code" -ErrorAction SilentlyContinue)) {
    Install-Scoop 
    scoop bucket add extras
    scoop install vscode
  }

  Install-CodeExtension "ms-vscode-remote.remote-ssh"
  Install-CodeExtension "ms-vscode-remote.remote-wsl"
  Install-CodeExtension "ms-vscode.remote-server"

  code

}