Conversation
- Implement TreeDragAndDropController in WorkspacesProvider - Drop onto a workspace group (or a project inside one) assigns the dragged workspaces to that group - Drop onto a project outside all groups or empty tree space removes them from their group - Add batch addWorkspaces/removeWorkspaces helpers to WorkspaceGroupsState - Fix stale group reference in addWorkspace (lookup by id) - Bump engine to ^1.66.0 (required for the DnD API) and declare the missing types via a local module augmentation to keep @types/vscode at 1.56.0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds drag-and-drop support to the Workspaces view so workspaces can be organized into custom workspace groups without opening the
Add to Group/Edit Workspacesmenus.Behaviour (scoped to custom workspace groups only):
Tagsheader) is ignored, so a stray drop never silently un-groups a workspace.Auto-sorted groups, favorites and tags are intentionally left untouched.
Implementation notes
WorkspacesProvidernow implementsvscode.TreeDragAndDropController<WorkspacesTreeItems>and is wired up viadragAndDropControllerincreateTreeView.application/vnd.code.tree.l13ProjectsWorkspaces) carrying the dragged project paths as JSON, so multi-select drags work.WorkspaceGroupsStategains batch helpersaddWorkspaces()/removeWorkspaces()that mirror the existing single-item methods: de-duplicate against the target group, remove each path from any other group, re-sort, save, and fire the existing change events so the tree refreshes.addWorkspace(): it mutated the group object passed in from the tree item, which is a fresh deserialized copy fromglobalState, not the object inside the saved array. The change was therefore persisted against an orphan. It now looks the group up byidfirst. The same lookup is used inaddWorkspaces().Type / engine handling — please review
TreeDragAndDropControllerrequires VS Code 1.66, soengines.vscodeis bumped to^1.66.0.However, bumping
@types/vscodepast 1.56 changesTreeItem.iconPath, which breaks ~20 existing assignments across the tree items (string paths are no longer assignable toUri-onlyIconPath). Rather than churn every tree item in a feature PR, this branch keeps@types/vscodeat 1.56.0 and declares only the missing drag-and-drop types in a local module augmentation (src/@types/vscode.d.ts, excluded from lint).Happy to instead upgrade
@types/vscodeand convert the icon paths tovscode.Uriin a follow-up if you'd prefer that approach.Checklist
gulp buildpasses (0 errors, 0 warnings)README.mddocuments the new interactionCHANGELOG.mdupdated under[Unreleased]Notes
package.json— left at2.0.0for you to decide the release number.