mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
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:
@@ -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()}`
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user