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

How to rename a workspace folder by using a "splice" style API? #42642

Closed
weinand opened this issue Jan 31, 2018 · 1 comment
Closed

How to rename a workspace folder by using a "splice" style API? #42642

weinand opened this issue Jan 31, 2018 · 1 comment
Assignees
Labels
*question Issue represents a question, should be posted to StackOverflow (VS Code)

Comments

@weinand
Copy link
Contributor

weinand commented Jan 31, 2018

testing #42195:

The "splice" API style results in this code for a simple rename:

function renameWorkspaceFolder(folder: vscode.WorkspaceFolder) {
    const allfolders = vscode.workspace.workspaceFolders;
    const ix = allfolders.indexOf(folder);
    vscode.workspace.updateWorkspaceFolders(ix, 1, { uri: folder.uri, name: 'new name' });
}

Or is there a simpler way to rename a folder programmatically?

@bpasero
Copy link
Member

bpasero commented Jan 31, 2018

@weinand no, you are doing it right. a rename of a folder is a remove and add at the same place.

@bpasero bpasero closed this as completed Jan 31, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Mar 17, 2018
@chrmarti chrmarti added *question Issue represents a question, should be posted to StackOverflow (VS Code) and removed question labels Jun 27, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*question Issue represents a question, should be posted to StackOverflow (VS Code)
Projects
None yet
Development

No branches or pull requests

3 participants