feat: automatically open workspaces in vscode in the dir specified (#6115)

This makes a one-click magical experience not only possible, but really nice too!
This commit is contained in:
Kyle Carberry
2023-02-09 06:38:34 +10:00
committed by GitHub
parent 2ed0eafd75
commit d803bb76d5
2 changed files with 6 additions and 1 deletions
@@ -119,6 +119,7 @@ export const AgentRow: FC<AgentRowProps> = ({
userName={workspace.owner_name}
workspaceName={workspace.name}
agentName={agent.name}
folderPath={agent.expanded_directory}
/>
)}
{applicationsHost !== undefined && applicationsHost !== "" && (
@@ -7,11 +7,12 @@ export interface VSCodeDesktopButtonProps {
userName: string
workspaceName: string
agentName?: string
folderPath?: string
}
export const VSCodeDesktopButton: FC<
PropsWithChildren<VSCodeDesktopButtonProps>
> = ({ 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()}`
})