Plugin/Extension

Which would be the best way to access the current workspace a user is using?

I’m trying to write either a plugin or extension that will allow the user to zip up their workspace and send it to another system.

I’ve been trying to find a way of accessing the workspace folder name from both an extension and a plugin but haven’t been able to find anything yet.

[original thread by steved1tommystech]

In the browser context, a user can select the project root and then use context menu to download it.

in VS Code extensions, you can use vscode.workspace.workspaceFolders https://github.com/microsoft/vscode/blob/8879cf69cd6f363c3f14c917976cad02246943b7/src/vs/vscode.d.ts#L8119

for Theia plugins just replace vscode with theia

for Theia extensions you can inject WorkspaceService from @theia/workspace and use tryGetRoots to access current workspace folders.

[steved1tommystech]

Thanks @anton-kosyakov for the quick response!! Much appreciated.