Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
feat: automatically open workspaces in vscode in the dir specified
This makes a one-click magical experience not only possible, but really nice too!
  • Loading branch information
kylecarbs committed Feb 8, 2023
commit 4ca4f0674f3a6a157daba0ff43a6e7e346e03d00
1 change: 1 addition & 0 deletions site/src/components/Resources/AgentRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 !== "" && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -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()}`
})
Expand Down