From 4ca4f0674f3a6a157daba0ff43a6e7e346e03d00 Mon Sep 17 00:00:00 2001 From: Kyle Carberry Date: Wed, 8 Feb 2023 20:08:48 +0000 Subject: [PATCH] feat: automatically open workspaces in vscode in the `dir` specified This makes a one-click magical experience not only possible, but really nice too! --- site/src/components/Resources/AgentRow.tsx | 1 + .../components/VSCodeDesktopButton/VSCodeDesktopButton.tsx | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/site/src/components/Resources/AgentRow.tsx b/site/src/components/Resources/AgentRow.tsx index 276d48f9922aa..d72a14b21ebbf 100644 --- a/site/src/components/Resources/AgentRow.tsx +++ b/site/src/components/Resources/AgentRow.tsx @@ -119,6 +119,7 @@ export const AgentRow: FC = ({ userName={workspace.owner_name} workspaceName={workspace.name} agentName={agent.name} + folderPath={agent.expanded_directory} /> )} {applicationsHost !== undefined && applicationsHost !== "" && ( diff --git a/site/src/components/VSCodeDesktopButton/VSCodeDesktopButton.tsx b/site/src/components/VSCodeDesktopButton/VSCodeDesktopButton.tsx index d52700da414a3..ad2e82dddbf70 100644 --- a/site/src/components/VSCodeDesktopButton/VSCodeDesktopButton.tsx +++ b/site/src/components/VSCodeDesktopButton/VSCodeDesktopButton.tsx @@ -7,11 +7,12 @@ export interface VSCodeDesktopButtonProps { userName: string workspaceName: string agentName?: string + folderPath?: string } export const VSCodeDesktopButton: FC< PropsWithChildren -> = ({ userName, workspaceName, agentName }) => { +> = ({ userName, workspaceName, agentName, folderPath }) => { const [loading, setLoading] = useState(false) return ( @@ -32,6 +33,9 @@ export const VSCodeDesktopButton: FC< if (agentName) { query.set("agent", agentName) } + if (folderPath) { + query.set("folder", folderPath) + } location.href = `vscode://coder.coder-remote/open?${query.toString()}` })