-
Notifications
You must be signed in to change notification settings - Fork 34.5k
Closed
Labels
Milestone
Description
Refs: #35407
Complexity: 3
There is new proposed API (updateWorkspaceFolders(start: number, deleteCount: number, ...workspaceFoldersToAdd: { uri: Uri, name?: string }[]): boolean
) to update the workspace folders of the workspace from an extension. The API provides full control over:
- removing existing folders
- adding new folders
- doing both at the same time (this allows to e.g. move an existing folder to another index)
Verify:
- the JSDoc of this method allows you to understand what the method is doing
- you see a little status message when a folder is added or removed with the name of the extension
- changes are always reflected without a window reload and the extension host continues to work (note that some transitions still require the extension host to restart, e.g. when the first folder changes)
- test with empty workspace, single folder workspace and multi-root workspace
- test adding folder(s), removing folder(s), and changing folders (e.g. rename a folder name or swapping folders position)
FYI - to test against the latest API do the following:
- open your extensions package.json file
- change the engine.vscode property to *
- run npm run postinstall (assuming you have the vscode module as dev-dependency)
- undo the engine-version change from step 2
- run with --enable-proposed-api
- copy the updateWorkspaceFolders method from vscode.proposed.d.ts into vscode.d.ts of the vscode node_module