Skip to content

Commit 6bf01bd

Browse files
committed
Add the codeWebChat.removeFolderFromWorkspace command to allow users to remove folders from the workspace via the context menu
1 parent b67ba27 commit 6bf01bd

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

‎apps/editor/package.json‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,12 @@
340340
"title": "Open in Integrated Terminal",
341341
"category": "Code Web Chat",
342342
"icon": "$(terminal)"
343+
},
344+
{
345+
"command": "codeWebChat.removeFolderFromWorkspace",
346+
"title": "Remove Folder from Workspace",
347+
"category": "Code Web Chat",
348+
"icon": "$(close)"
343349
}
344350
],
345351
"submenus": [
@@ -505,6 +511,10 @@
505511
{
506512
"command": "codeWebChat.checkReferencingFilesForContext",
507513
"when": "false"
514+
},
515+
{
516+
"command": "codeWebChat.removeFolderFromWorkspace",
517+
"when": "false"
508518
}
509519
],
510520
"view/title": [
@@ -667,6 +677,11 @@
667677
"when": "view == codeWebChatViewWorkspace && (viewItem == workspaceRoot || viewItem == directory)",
668678
"group": "1_modification@7"
669679
},
680+
{
681+
"command": "codeWebChat.removeFolderFromWorkspace",
682+
"when": "(view == codeWebChatViewWorkspace || view == codeWebChatViewContext) && (viewItem == workspaceRoot || viewItem == contextWorkspaceRoot) && workspaceFolderCount > 1",
683+
"group": "1_modification@8"
684+
},
670685
{
671686
"command": "codeWebChat.newFile",
672687
"when": "view == codeWebChatViewWorkspace && viewItem == directory",

‎apps/editor/src/context/context-initialization.ts‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,17 @@ export const context_initialization = async (
372372
await open_editors_provider!.check_all()
373373
}
374374
),
375+
vscode.commands.registerCommand(
376+
'codeWebChat.removeFolderFromWorkspace',
377+
async (item: FileItem) => {
378+
if (!item?.resourceUri) return
379+
380+
const folder = vscode.workspace.getWorkspaceFolder(item.resourceUri)
381+
if (folder) {
382+
vscode.workspace.updateWorkspaceFolders(folder.index, 1)
383+
}
384+
}
385+
),
375386
apply_context_command(
376387
workspace_provider,
377388
() => {

0 commit comments

Comments
 (0)