From b2e8f1ea6a7f69a0439c80008256a695a1336bb5 Mon Sep 17 00:00:00 2001 From: Ehab Younes Date: Fri, 13 Mar 2026 15:59:04 +0300 Subject: [PATCH] fix: show Tasks view container in Cursor when not authenticated Cursor has a bug where view containers whose views are all hidden via `when` clauses never re-appear after the context changes. Add a placeholder login tree view so the coderTasks container always has at least one visible view. Fixes #838 --- package.json | 11 +++++++++++ src/extension.ts | 12 ++++++++++++ 2 files changed, 23 insertions(+) diff --git a/package.json b/package.json index bfe0dabf..33308f34 100644 --- a/package.json +++ b/package.json @@ -211,6 +211,12 @@ } ], "coderTasks": [ + { + "id": "coder.tasksLogin", + "name": "Coder Tasks", + "icon": "media/tasks-logo.svg", + "when": "!coder.authenticated" + }, { "type": "webview", "id": "coder.tasksPanel", @@ -225,6 +231,11 @@ "view": "myWorkspaces", "contents": "Coder is a platform that provisions remote development environments. \n[Login](command:coder.login)", "when": "!coder.authenticated && coder.loaded" + }, + { + "view": "coder.tasksLogin", + "contents": "Sign in to view and manage Coder tasks.\n[Login](command:coder.login)", + "when": "!coder.authenticated && coder.loaded" } ], "commands": [ diff --git a/src/extension.ts b/src/extension.ts index 9266bf54..58c1e6b4 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -188,6 +188,18 @@ export async function activate(ctx: vscode.ExtensionContext): Promise { // controlled by contexts, see `when` in the package.json. const commands = new Commands(serviceContainer, client, deploymentManager); + // Placeholder tree view for the coderTasks container when not authenticated. + // Works around a Cursor bug where containers with all views hidden via `when` + // clauses never re-appear after the context changes. + ctx.subscriptions.push( + vscode.window.createTreeView("coder.tasksLogin", { + treeDataProvider: { + getTreeItem: () => new vscode.TreeItem(""), + getChildren: () => [], + }, + }), + ); + // Register Tasks webview panel with dependencies const tasksPanelProvider = new TasksPanelProvider( ctx.extensionUri,