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

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.


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