How to assign workspace folder path in vscode exte

2019-08-22 11:24发布

I am trying to set workspace folder custom but not working.How to assign workspacefolder path.Where i did mistake.If anyone can find that mistake from my code know please help me to resolve this issue.

Actually my workspacefolderpath ="c://mamp/projects/treemaintain/tree/";

but i want to assign in some condition like workspacefolderpath ="c://mamp/projects/treemaintain/";

extension.js:

        const getWorkspaceFolder = async () => {
        // If in a multifolder workspace, prompt user to select which one to traverse.


 vscode.workspace.workspaceFolders.path="c://mamp/projects/treemaintain/";

        if (vscode.workspace.workspaceFolders.length > 1) {
            const selected = await vscode.window.showQuickPick(vscode.workspace.workspaceFolders.map(folder => ({
                label: folder.name,
                folder
            })), {
                placeHolder: 'Select workspace folder'
            });

            if (!selected) {
                return;
            }

            return selected.folder;
    }

        // Otherwise, use the first one

 vscode.workspace.workspaceFolders[0]="c://mamp/projects/treemaintain/";
        const folder = vscode.workspace.workspaceFolders[0];
        return folder;
    };

0条回答
登录 后发表回答