From bdddcde6fb2738e3f524fdb14d12c2ad64b14b77 Mon Sep 17 00:00:00 2001 From: Toma Puljak Date: Wed, 11 Sep 2024 11:45:59 +0200 Subject: [PATCH] fix: install code extensions on create (#1088) Signed-off-by: Toma Puljak --- pkg/cmd/workspace/create.go | 2 +- pkg/ide/browser.go | 4 ++++ pkg/ide/cursor.go | 4 ++++ pkg/ide/vscode.go | 4 ++++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/pkg/cmd/workspace/create.go b/pkg/cmd/workspace/create.go index 6988b36f7f..e35fd7ad99 100644 --- a/pkg/cmd/workspace/create.go +++ b/pkg/cmd/workspace/create.go @@ -179,7 +179,7 @@ var CreateCmd = &cobra.Command{ // Make sure terminal cursor is reset fmt.Print("\033[?25h") - wsInfo, res, err := apiClient.WorkspaceAPI.GetWorkspace(ctx, workspaceName).Execute() + wsInfo, res, err := apiClient.WorkspaceAPI.GetWorkspace(ctx, workspaceName).Verbose(true).Execute() if err != nil { log.Fatal(apiclient_util.HandleErrorResponse(res, err)) } diff --git a/pkg/ide/browser.go b/pkg/ide/browser.go index 84d6aaeef6..9d7ffacbde 100644 --- a/pkg/ide/browser.go +++ b/pkg/ide/browser.go @@ -84,6 +84,10 @@ func OpenBrowserIDE(activeProfile config.Profile, workspaceId string, projectNam log.Error("Error opening URL: " + err.Error()) } + if projectProviderMetadata == "" { + return nil + } + err = setupVSCodeCustomizations(projectHostname, projectProviderMetadata, devcontainer.Browser, "*/vscode-server/bin/openvscode-server", "$HOME/.openvscode-server/data/Machine/settings.json", ".daytona-customizations-lock-vscode-browser") if err != nil { log.Errorf("Error setting up IDE customizations: %s", err) diff --git a/pkg/ide/cursor.go b/pkg/ide/cursor.go index c1d6d8c6dd..682172cfa8 100644 --- a/pkg/ide/cursor.go +++ b/pkg/ide/cursor.go @@ -36,6 +36,10 @@ func OpenCursor(activeProfile config.Profile, workspaceId string, projectName st return err } + if projectProviderMetadata == "" { + return nil + } + return setupVSCodeCustomizations(projectHostname, projectProviderMetadata, devcontainer.Vscode, "*/.cursor-server/*/bin/cursor-server", "$HOME/.cursor-server/data/Machine/settings.json", ".daytona-customizations-lock-cursor") } diff --git a/pkg/ide/vscode.go b/pkg/ide/vscode.go index c101b88e56..39c8d2acba 100644 --- a/pkg/ide/vscode.go +++ b/pkg/ide/vscode.go @@ -38,6 +38,10 @@ func OpenVSCode(activeProfile config.Profile, workspaceId string, projectName st return err } + if projectProviderMetadata == "" { + return nil + } + return setupVSCodeCustomizations(projectHostname, projectProviderMetadata, devcontainer.Vscode, "*/.vscode-server/*/bin/code-server", "$HOME/.vscode-server/data/Machine/settings.json", ".daytona-customizations-lock-vscode") }