-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for VS Code Insiders IDE
Signed-off-by: hunnywar <[email protected]>
- Loading branch information
Showing
9 changed files
with
83 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
// Copyright 2024 Daytona Platforms Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package ide | ||
|
||
import ( | ||
"errors" | ||
"fmt" | ||
"os/exec" | ||
|
||
"github.com/daytonaio/daytona/cmd/daytona/config" | ||
"github.com/daytonaio/daytona/internal/util" | ||
"github.com/daytonaio/daytona/pkg/build/devcontainer" | ||
) | ||
|
||
func OpenVSCodeInsiders(activeProfile config.Profile, workspaceId string, projectName string, projectProviderMetadata string, gpgKey string) error { | ||
path, err := GetVSCodeInsidersBinaryPath() | ||
if err != nil { | ||
return err | ||
} | ||
err = installRemoteSSHExtension(path) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
projectHostname := config.GetProjectHostname(activeProfile.Id, workspaceId, projectName) | ||
|
||
projectDir, err := util.GetProjectDir(activeProfile, workspaceId, projectName, gpgKey) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
commandArgument := fmt.Sprintf("vscode-remote://ssh-remote+%s/%s", projectHostname, projectDir) | ||
|
||
vscCommand := exec.Command(path, "--disable-extension", "ms-vscode-remote.remote-containers", "--folder-uri", commandArgument) | ||
|
||
err = vscCommand.Run() | ||
if err != nil { | ||
return err | ||
} | ||
|
||
if projectProviderMetadata == "" { | ||
return nil | ||
} | ||
|
||
return setupVSCodeCustomizations(projectHostname, projectProviderMetadata, devcontainer.Vscode, "*/.vscode-server-insiders/*/bin/code-server-insiders", "$HOME/.vscode-server-insiders/data/Machine/settings.json", ".daytona-customizations-lock-vscode-insiders") | ||
} | ||
|
||
func GetVSCodeInsidersBinaryPath() (string, error) { | ||
path, err := exec.LookPath("code-insiders") | ||
if err == nil { | ||
return path, err | ||
} | ||
|
||
redBold := "\033[1;31m" // ANSI escape code for red and bold | ||
reset := "\033[0m" // ANSI escape code to reset text formatting | ||
|
||
errorMessage := "Please install Visual Studio Code Insiders from https://code.visualstudio.com/insiders/\n\n" | ||
infoMessage := ` | ||
If you have already installed Visual Studio Code Insiders, please ensure it is added to your PATH environment variable. | ||
You can verify this by running the following command in your terminal: | ||
code-insiders | ||
` | ||
|
||
return "", errors.New(redBold + errorMessage + reset + infoMessage) | ||
} |
This file contains 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