Skip to content

addWorkspaceFolder / removeWorkspaceFolder are not effective API #37301

Description

@alexdima

Testing #37133

fyi @jrieken .


  • observe that a WorkspaceFolder has three fields: uri, name and index.
  • observe the reading API: export let workspaceFolders: WorkspaceFolder[] | undefined;

IMHO, the editing API seems out of place:

  • removeWorkspaceFolder takes as argument a single WorkspaceFolder; why a single one ?
  • addWorkspaceFolder also takes in a single WorkspaceFolder; why ? It also ignores the index property; how to add something at the beginning of the array ?

e.g. of difficulty:

  • how to implement replace folder at i with another folder. i.e. workspaceFolders[i] = newWorkspaceFolder:
    • remove N folders where folder.index >= i, i.e. call removeWorkspaceFolder N times
    • add N folders back again i.e. call addWorkspaceFolder N times

IMHO a much simpler API would be a setWorkspaceFolders(newWorkspaceFolders: WorkspaceFolder[])

Metadata

Metadata

Assignees

Labels

*duplicateIssue identified as a duplicate of another issue(s)apifeature-requestRequest for new features or functionalityunder-discussionIssue is under discussion for relevance, priority, approachworkbench-multirootMulti-root (multiple folders) issues

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions