-
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 VSCodium Insiders
Signed-off-by: hunnywar <[email protected]>
- Loading branch information
Showing
8 changed files
with
79 additions
and
4 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 OpenVScodiumInsiders(activeProfile config.Profile, workspaceId string, projectName string, projectProviderMetadata string, gpgkey string) error { | ||
path, err := GetCodiumInsidersBinaryPath() | ||
if err != nil { | ||
return err | ||
} | ||
// Install the extension if not installed | ||
err = installExtension(path, requiredExtension) | ||
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) | ||
|
||
codiumInsidersCommand := exec.Command(path, "--disable-extension", "ms-vscode-remote.remote-containers", "--folder-uri", commandArgument) | ||
|
||
err = codiumInsidersCommand.Run() | ||
if err != nil { | ||
return err | ||
} | ||
|
||
if projectProviderMetadata == "" { | ||
return nil | ||
} | ||
|
||
return setupVSCodeCustomizations(projectHostname, projectProviderMetadata, devcontainer.Vscode, "*/.vscodium-server-insiders/*/bin/codium-server-insiders", "$HOME/.vscodium-server-insiders/data/Machine/settings.json", ".daytona-customizations-lock-codium-insiders") | ||
} | ||
|
||
func GetCodiumInsidersBinaryPath() (string, error) { | ||
path, err := exec.LookPath("codium-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 VScodium Insiders from https://github.com/VSCodium/vscodium-insiders\n\n" | ||
infoMessage := ` | ||
If you have already installed VScodium Insiders, please ensure it is added to your PATH environment variable. | ||
You can verify this by running the following command in your terminal: | ||
codium-insiders | ||
` | ||
|
||
return "", errors.New(redBold + errorMessage + reset + infoMessage) | ||
} |