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

Test improved workspace edit api #52800

Closed
2 tasks done
jrieken opened this issue Jun 25, 2018 · 2 comments
Closed
2 tasks done

Test improved workspace edit api #52800

jrieken opened this issue Jun 25, 2018 · 2 comments

Comments

@jrieken
Copy link
Member

jrieken commented Jun 25, 2018

Refs: #10659

Complexity: 2

We have enhanced the WorkspaceEdit-api to allow to create, delete, and rename files. Test that

  • everything works as advertised
  • things behave reasonable in corner cases, e.g. delete a file, then update it
@jrieken jrieken added this to the June 2018 milestone Jun 25, 2018
@jrieken
Copy link
Member Author

jrieken commented Jun 25, 2018

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
  • from the vscode-repo copy the vscode.proposed.d.ts-file into your project
  • in your package.json file add enableProposedApi: true

@jrieken jrieken modified the milestone: June 2018 Jun 25, 2018
@isidorn
Copy link
Contributor

isidorn commented Jun 26, 2018

Here's an example to help with testing

'use strict';
// The module 'vscode' contains the VS Code extensibility API
// Import the module and reference it with the alias vscode in your code below
import * as vscode from 'vscode';

// this method is called when your extension is activated
// your extension is activated the very first time the command is executed
export function activate(context: vscode.ExtensionContext) {

    let disposable = vscode.commands.registerCommand('extension.sayHello', () => {
        const workspaceEdit = new vscode.WorkspaceEdit();
        workspaceEdit.deleteFile(vscode.Uri.file('/Users/isidor/development/w/june/one'));
        workspaceEdit.createFile(vscode.Uri.file('/Users/isidor/development/w/june/two'));
        workspaceEdit.renameFile(vscode.Uri.file('/Users/isidor/development/w/june/two'), vscode.Uri.file('/Users/isidor/development/w/june/two'));
        vscode.workspace.applyEdit(workspaceEdit);
    });

    context.subscriptions.push(disposable);
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants