Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide additional workspace API (read / write) #35407

Closed
ejizba opened this issue Sep 30, 2017 · 17 comments · Fixed by #42026
Closed

Provide additional workspace API (read / write) #35407

ejizba opened this issue Sep 30, 2017 · 17 comments · Fixed by #42026
Assignees
Labels
api feature-request Request for new features or functionality on-testplan remote Remote system operations issues workbench-multiroot Multi-root (multiple folders) issues
Milestone

Comments

@ejizba
Copy link
Member

ejizba commented Sep 30, 2017

Today I can call vscode.openFolder to open a folder programmatically:

vscode.commands.executeCommand("vscode.openFolder", vscode.Uri.file(path), false);

However, I would like to be able to do the same thing with the new multi-root workspace and just add a folder to the workspace. Something like this, but where I can pass in a Uri

For more context on our scenario, see @chrisdias's comments on this issue: #13807

NOTE: We realize such a command might restart the extension host, but we don't care if that happens.

@vscodebot vscodebot bot added the workbench label Sep 30, 2017
@isidorn isidorn assigned bpasero and unassigned isidorn Oct 2, 2017
@bpasero bpasero added the api label Oct 2, 2017
@bpasero bpasero added this to the Backlog milestone Oct 2, 2017
@bpasero bpasero added the feature-request Request for new features or functionality label Oct 2, 2017
@bpasero
Copy link
Member

bpasero commented Oct 2, 2017

fyi @jrieken @sandy081 I guess eventually it would make sense to expose some kind of workspace editing API to extensions.

@sandy081 sandy081 self-assigned this Oct 2, 2017
@jrieken jrieken added workbench-multiroot Multi-root (multiple folders) issues remote Remote system operations issues and removed remote Remote system operations issues labels Oct 2, 2017
@jrieken
Copy link
Member

jrieken commented Oct 2, 2017

I like, tho the weird thing we need to communicate is that calling such API might restart the extension itself

@ejizba
Copy link
Member Author

ejizba commented Oct 2, 2017

The 'openFolder' api has the same behavior and just includes this in the description:

Open a folder in the current window or new window depending on the newWindow argument. Note that opening in the same window will shutdown the current extension host process and start a new one on the given folder unless the newWindow parameter is set to true.

@bpasero bpasero changed the title Feature request: command to programmatically add a folder to workspace Provide additional workspace API (read / write / metadata) Oct 17, 2017
@bpasero bpasero modified the milestones: Backlog, October 2017 Oct 24, 2017
bpasero added a commit that referenced this issue Oct 30, 2017
…35407) (#36820)

* Provide additional workspace API to add/remove workspace folders (for #35407)

* add/removeFolders => add/removeFolder

* make add/remove folder return a boolean

* use proper service for workspace editing

* workspac => workspace

* do not log promise canceled messages

* show confirm dialog
@bpasero
Copy link
Member

bpasero commented Oct 30, 2017

This landed as workspace.addWorkspaceFolder and workspace.removeWorkspaceFolder.

@bpasero bpasero closed this as completed Oct 30, 2017
egamma pushed a commit that referenced this issue Oct 31, 2017
…35407) (#36820)

* Provide additional workspace API to add/remove workspace folders (for #35407)

* add/removeFolders => add/removeFolder

* make add/remove folder return a boolean

* use proper service for workspace editing

* workspac => workspace

* do not log promise canceled messages

* show confirm dialog
@bpasero bpasero reopened this Nov 1, 2017
@bpasero
Copy link
Member

bpasero commented Nov 5, 2017

@stef-levesque no, closing a workspace is currently not closing any documents.

@ejizba
Copy link
Member Author

ejizba commented Dec 19, 2017

@bpasero any update on this? I see the api was removed because of #37301, but we don't need all of the functionality listed in that. We just want a single command to add a folder to a workspace. If 'remove' and 'insert' are blocking 'add', can we save those for later?

@bpasero
Copy link
Member

bpasero commented Dec 20, 2017

@EricJizbaMSFT no update so far other than this is "on deck" so it will happen eventually. Please talk to @egamma or @kieferrm to put some pressure on this if this must happen at a specific time and thus have it planned for an iteration.

@bpasero
Copy link
Member

bpasero commented Jan 12, 2018

@EricJizbaMSFT can you share more details on your scenario of adding a workspace folder from an extension?

@chrisdias
Copy link
Member

azure function extension is a good example, it lets you create a new Azure Function "project", which is really just a folder.

So, imagine I have a folder open, my web app called "stickerApp". It could be the only folder open, or it could be a part of a workspace.

image

With the Azure Functions extension I choose to "Create a new Azure Function Project" from the command palette or the explorer commands.

image

This command first prompts me for the folder location in which to scaffold the project:

image

I choose Browse... and get the folder picker:

image

And I pick some new folder called stickerFunctions

The func cli then scaffolds out the new sticker function in the stickerFunctions folder.

At this point I probably want to start working on this function. Ideally it would be added to the explorer as a second top level root node:

image

@jrieken jrieken added the remote Remote system operations issues label Jan 12, 2018
@bpasero bpasero modified the milestones: On Deck, January 2018 Jan 15, 2018
@bpasero bpasero modified the milestones: January 2018, February 2018 Jan 16, 2018
@egamma egamma modified the milestones: February 2018, January 2018 Jan 22, 2018
@bpasero bpasero changed the title Provide additional workspace API (read / write / metadata) Provide additional workspace API (read / write) Jan 23, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Mar 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api feature-request Request for new features or functionality on-testplan remote Remote system operations issues workbench-multiroot Multi-root (multiple folders) issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants