Skip to content

Commit 3def748

Browse files
authored
feat: add experimental workspaces view (#947)
> 🤖 This PR was modified by Coder Agents on behalf of Jake Howell. Scaffolds a new experimental Workspaces webview panel behind the `coder.experimental.workspacesPanel` setting, giving us a blank canvas to iterate on a redesigned workspaces experience. The feature is fully gated and hidden from the Settings UI so it won't affect existing users. - Adds a `packages/workspaces` package with a React + Vite + React Query entrypoint and Storybook support - Registers a new `coderExperimentalWorkspaces` activity bar view container ("Coder Remote (New)") visible only when the flag is enabled and the user is authenticated - Introduces `ExperimentalWorkspacesPanelProvider` implementing `WebviewViewProvider` with IPC dispatch scaffolding and deployment-change refresh wiring - Gates everything behind `coder.experimental.workspacesPanel` (boolean, default `false`) — sets the `coder.experimental.webkitWorkspaces` context key to control view visibility - Adds a `coder.workspaces.refresh` command for manual panel refresh
1 parent 21d88bb commit 3def748

16 files changed

Lines changed: 302 additions & 0 deletions

File tree

package.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,11 @@
295295
"id": "coderTasks",
296296
"title": "Coder Tasks",
297297
"icon": "media/tasks-logo.svg"
298+
},
299+
{
300+
"id": "coderExperimentalWorkspaces",
301+
"title": "Coder Remote (New)",
302+
"icon": "media/shorthand-logo.svg"
298303
}
299304
]
300305
},
@@ -328,6 +333,15 @@
328333
"icon": "media/tasks-logo.svg",
329334
"when": "coder.authenticated"
330335
}
336+
],
337+
"coderExperimentalWorkspaces": [
338+
{
339+
"type": "webview",
340+
"id": "coder.workspacesPanel",
341+
"name": "Workspaces",
342+
"icon": "media/shorthand-logo.svg",
343+
"when": "coder.authenticated && coder.workspacesPanelEnabled"
344+
}
331345
]
332346
},
333347
"viewsWelcome": [

packages/shared/src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@ export {
1616
type SpeedtestInterval,
1717
type SpeedtestResult,
1818
} from "./speedtest/api";
19+
20+
// Workspaces API
21+
export { WorkspacesApi } from "./workspaces/api";
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const WorkspacesApi = {} as const;

packages/workspaces/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Coder Workspaces Webview Panel
2+
3+
This package contains the Workspaces webview panel for the Coder VS Code extension.
4+
5+
## Enabling the Feature
6+
7+
The workspaces panel is controlled by the `coder.experimental.workspacesPanel` configuration setting.
8+
9+
To enable via settings.json:
10+
11+
1. Open your VS Code settings.json (Cmd/Ctrl + Shift + P → "Preferences: Open User Settings (JSON)")
12+
2. Add the following:
13+
14+
```json
15+
{
16+
"coder.experimental.workspacesPanel": true
17+
}
18+
```
19+
20+
3. Reload VS Code
21+
22+
A new activity bar icon labeled **"Coder Remote (New)"** will appear when the setting is enabled.

packages/workspaces/package.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"name": "@repo/workspaces",
3+
"version": "1.0.0",
4+
"description": "Coder Workspaces webview panel",
5+
"private": true,
6+
"type": "module",
7+
"scripts": {
8+
"build": "vite build",
9+
"dev": "vite build --watch",
10+
"typecheck": "tsc --noEmit"
11+
},
12+
"dependencies": {
13+
"@repo/shared": "workspace:*",
14+
"@repo/webview-shared": "workspace:*",
15+
"@tanstack/react-query": "catalog:",
16+
"@vscode-elements/react-elements": "catalog:",
17+
"@vscode/codicons": "catalog:",
18+
"date-fns": "catalog:",
19+
"react": "catalog:",
20+
"react-dom": "catalog:"
21+
},
22+
"devDependencies": {
23+
"@repo/mocks": "workspace:*",
24+
"@repo/storybook-utils": "workspace:*",
25+
"@rolldown/plugin-babel": "catalog:",
26+
"@types/react": "catalog:",
27+
"@types/react-dom": "catalog:",
28+
"@vitejs/plugin-react": "catalog:",
29+
"babel-plugin-react-compiler": "catalog:",
30+
"typescript": "catalog:",
31+
"vite": "catalog:"
32+
}
33+
}

packages/workspaces/src/App.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default function App() {
2+
return <div>TODO</div>;
3+
}

packages/workspaces/src/css.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
declare module "*.css";

packages/workspaces/src/index.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/* TODO */

packages/workspaces/src/index.tsx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { ErrorBoundary } from "@repo/webview-shared/react";
2+
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
3+
import { StrictMode } from "react";
4+
import { createRoot } from "react-dom/client";
5+
6+
import App from "./App";
7+
import "./index.css";
8+
9+
const queryClient = new QueryClient();
10+
11+
const root = document.getElementById("root");
12+
if (!root) {
13+
throw new Error(
14+
"Failed to find root element. The webview HTML must contain an element with id='root'.",
15+
);
16+
}
17+
18+
createRoot(root).render(
19+
<StrictMode>
20+
<QueryClientProvider client={queryClient}>
21+
<ErrorBoundary>
22+
<App />
23+
</ErrorBoundary>
24+
</QueryClientProvider>
25+
</StrictMode>,
26+
);
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import "./src/index.css";

0 commit comments

Comments
 (0)