Skip to content

Comments

Replace WebDAV Browser webview with native TreeView#174

Closed
clavery wants to merge 3 commits intomainfrom
feature/content-treeview
Closed

Replace WebDAV Browser webview with native TreeView#174
clavery wants to merge 3 commits intomainfrom
feature/content-treeview

Conversation

@clavery
Copy link
Collaborator

@clavery clavery commented Feb 20, 2026

Summary

  • Replaces the HTML webview (webdav.html) with a native VS Code TreeDataProvider sidebar, giving the extension its first Activity Bar presence
  • Adds "B2C-DX WebDAV" container with collapsible tree browsing, context menus, keyboard navigation, and theme support out of the box
  • Adds WebDavFileSystemProvider backed by the SDK's WebDAV client — enables opening, editing, and saving files directly via VS Code's native editor
  • Root nodes use standard folder icons for a native look
  • Open as Workspace Folder context menu command mounts any root or directory (e.g. Cartridges, Cartridges/my-cartridge) into the native Explorer for full file-management UX; unmount via VS Code's built-in "Remove Folder from Workspace"
  • Replaces "*" activation event with targeted onView:b2cWebdavExplorer and onFileSystem:b2c-webdav activation
  • Removes ~240 lines of inline webview message-passing code from extension.ts

New files

File Purpose
src/webdav-tree/webdav-config.ts WebDavConfigProvider — lazy config resolution + B2CInstance caching
src/webdav-tree/webdav-fs-provider.ts WebDavFileSystemProvider — stat, readDirectory, readFile, writeFile, createDirectory, delete with caching
src/webdav-tree/webdav-tree-provider.ts WebDavTreeDataProvider + WebDavTreeItem (root/directory/file nodes)
src/webdav-tree/webdav-commands.ts 8 command handlers: refresh, newFolder, newFile, uploadFile, delete, download, openFile, mountWorkspace
src/webdav-tree/index.ts registerWebDavTree() wiring function
media/b2c-icon.svg Activity Bar icon

Commands & menus

  • Refresh button in view title bar
  • New File / New Folder / Upload File on right-click for root and directory nodes
  • Open as Workspace Folder on right-click for root and directory nodes — mounts that specific path (e.g. WebDAV: Cartridges/my-cartridge) into the native Explorer
  • Open File / Download on right-click for file nodes
  • Delete on right-click for directory and file nodes (not root nodes)
  • Download available in native Explorer context menu for b2c-webdav files
  • Single-click on a file opens it via vscode.open using the FileSystemProvider

FileSystemProvider

The WebDavFileSystemProvider enables VS Code's native file operations:

  • Open/edit/save files directly in VS Code editors
  • Create files and directories from both the sidebar tree and the native Explorer
  • 30-second stat/directory cache with automatic invalidation on writes and deletes
  • Root path (b2c-webdav:/) returns a synthetic listing of the 9 well-known B2C Commerce directories (Impex, Temp, Cartridges, etc.) without hitting the server

Welcome view

When no B2C instance is configured (i.e. no dw.json or SFCC_* env vars), the tree shows a welcome message with a Refresh link.

Replace the 561-line HTML webview (webdav.html) with a VS Code native
TreeDataProvider sidebar. This gives the extension its first Activity Bar
presence and provides collapsible tree browsing, context menus, keyboard
navigation, theming, and accessibility for free.

- Add Activity Bar container "B2C-DX WebDAV" with sidebar tree view
- Lazy-load directory contents via PROPFIND with caching
- Context menu commands: New Folder, Upload, Delete, Download, Open File
- Open files via temp storage with native VS Code editors (syntax
  highlighting, image viewer, etc.)
- Welcome view when no B2C instance is configured
- Replace "*" activation event with targeted onView activation
- Remove webdav.html and all inline webview message handling (~240 lines)
- Add WebDavFileSystemProvider with caching, stat/readDirectory/readFile/
  writeFile/createDirectory/delete operations against WebDAV
- Root path handling returns synthetic directory listing of the 9 well-known
  B2C Commerce roots (avoids PROPFIND on "/")
- Tree provider delegates to FS provider instead of calling WebDAV directly;
  root nodes use standard folder icons via resourceUri
- New File command: prompts for filename, creates empty file, opens in editor
- Mount/Unmount Workspace commands: add/remove b2c-webdav:/ as a VS Code
  workspace folder for native Explorer integration
- Context key b2c-dx.webdav.mounted tracks mount state for menu visibility
- Download command available in native Explorer context menu for b2c-webdav files
@clavery clavery marked this pull request as ready for review February 20, 2026 03:34
@clavery clavery requested a review from wei-liu-sf as a code owner February 20, 2026 03:34
Change "Open as Workspace Folder" to operate on the right-clicked
node (root or directory) rather than mounting b2c-webdav:/ globally.
The workspace folder is named "WebDAV: <path>" for clarity.

Move mount command from view title bar to context menu. Remove
unmountWorkspace command and mounted context key tracking — VS Code's
native "Remove Folder from Workspace" handles unmounting.
@clavery
Copy link
Collaborator Author

clavery commented Feb 22, 2026

Superseded by #186

@clavery clavery closed this Feb 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant