Skip to content

Commit

Permalink
feat: auto install remote SSH extension in vscode
Browse files Browse the repository at this point in the history
  • Loading branch information
tarunrajput committed Sep 24, 2024
1 parent f66dc4a commit c50d9dd
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions pkg/ide/vscode.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ import (

func OpenVSCode(activeProfile config.Profile, workspaceId string, projectName string, projectProviderMetadata string) error {
CheckAndAlertVSCodeInstalled()
err := installRemoteSSHExtension()
if err != nil {
return err
}

projectHostname := config.GetProjectHostname(activeProfile.Id, workspaceId, projectName)

Expand Down Expand Up @@ -191,3 +195,19 @@ func isVSCodeInstalled() error {
_, err := exec.LookPath("code")
return err
}

func installRemoteSSHExtension() error {
output, err := exec.Command("code", "--list-extensions").Output()
if err != nil {
return err
}

if !strings.Contains(string(output), "ms-vscode-remote.remote-ssh") {
fmt.Println("Installing Remote SSH extension...")
err = exec.Command("code", "--install-extension", "ms-vscode-remote.remote-ssh").Run()
if err != nil {
return err
}
}
return nil
}

0 comments on commit c50d9dd

Please sign in to comment.