Vscode-project-manager: Support VS Code Multi-root Workspaces

Created on 15 Oct 2017  路  13Comments  路  Source: alefragnani/vscode-project-manager

enhancement

Most helpful comment

Hi @ClementVidal ,

When I created the file structure, the initial idea was to use the paths field to add _other folders_ to the project, creating a multi-root workspace. But the multi-root concept in VS Code ended up a bit diferent, and for now, there is no API that I can use to _create a workspace on the fly_. So, the path field still don't have any effect. By bad that the readme hasn't been updated to say that, sorry 馃槩

It appears that you can _open multiple folders at once_ via command line, but I didn't test it via API (extension). Maybe, if this works, I would be able to _mimic_ the workspace creation _on the fly_. There is also #121 which asks to use the paths field for another approach.

As you can see in my first comment, this is just the _basic approach_ for multi-root workspaces. I also don't know if the decision to use just the _first folder_ as the project is good, or if I should expand to _any folder in workspace_ (still waiting for feedback). I sill want to add, at least #151, but it depends on new VS Code API.

Hope this helps

All 13 comments

@alefragnani let me know if you have any questions are want to discuss multi-root. The related wiki page for help is: https://github.com/Microsoft/vscode/wiki/Extension-Authoring:-Adopting-Multi-Root-Workspace-APIs

A _basic approach_ is ready.

Since the extension purpose is to _Open Folder_, and a Workspace is, in essence, a _list of folders_, I think that simply using workspaceFolders[0] in replacement to the original rootPath works fine.

The basic idea is: the user uses the first folder in the workspace, as its _main folder_. And the extension uses this _main folder_ just like it would use the original rootPath in a single folder concept.

  • Show the project name in Status Bar
  • Suggest the project name, when saving a Project
  • Filter the project from the Project List

The _bad_ in this case: the extension does not open the workspace when the project is selected, but only the first folder of that workspace.

What I think that should be a _better approach_: The Project List concept, which today only accept Folders, should also add Workspaces as Projects. Doing so, the user should have a folder alone as a project, and also as the first folder in a workspace. The _bad_ point described earlier would be fixed.

To do this, a new Command should be created: Project Manager: Save Workspace.

@alefragnani it seems to me that for the basic folder scenario using workspaceFolders[0] is fine, however if a user has opened a workspace (with 0-N root folders) I believe it would be nice if a user could store this workspace in your list as well (I think that is what you are suggesting).

Unfortunately today we do not provide additional APIs for extension authors to know e.g. the location of the workspace file. We have https://github.com/Microsoft/vscode/issues/35407 opened to track this request.

@bpasero that's exactly what I'm suggesting 馃憤. That's why I decided to keep with the _basic scenario_, for now.

It's good to know that you already have a request to provide aditional API. I will subscribe on that to be notified when available.

Thanks for you help

It's done. I will wait until the multi-root feature arrives in stable channel.

Just stumbling in here because I was interested in the feature, looks like multi-root folders has landed in Stable 馃帀 https://github.com/Microsoft/vscode/issues/396#issuecomment-341387730

It's almost there 馃憤

Since 0.23.0 this extension can handle Multi-root workspace.
However, i'm not able to make it work correctly.
The README mention:
The paths and group fields are there to be used in the future by two new features: Support multiple folders in the same project and Contextual Structure for Projects .

How is this supposed to be used ?

Hi @ClementVidal ,

When I created the file structure, the initial idea was to use the paths field to add _other folders_ to the project, creating a multi-root workspace. But the multi-root concept in VS Code ended up a bit diferent, and for now, there is no API that I can use to _create a workspace on the fly_. So, the path field still don't have any effect. By bad that the readme hasn't been updated to say that, sorry 馃槩

It appears that you can _open multiple folders at once_ via command line, but I didn't test it via API (extension). Maybe, if this works, I would be able to _mimic_ the workspace creation _on the fly_. There is also #121 which asks to use the paths field for another approach.

As you can see in my first comment, this is just the _basic approach_ for multi-root workspaces. I also don't know if the decision to use just the _first folder_ as the project is good, or if I should expand to _any folder in workspace_ (still waiting for feedback). I sill want to add, at least #151, but it depends on new VS Code API.

Hope this helps

Any chance this feature is available or incoming?

I'd love to be able to open my project and have both the project root and it's theme folders open automatically instead of having to manually add the project's subdirectories manually.

Hi @andy-blum , do you mean #151 (Support save Workspaces as projects)?

To be honest, I'm not super familiar with VS Code.

I primarily build and theme drupal sites and would love to have a way to open up both the project root and the custom theme subdirectory, 4 folders deep

My understanding is that the path variable would store an array of paths to open in the file explorer

Your description seems like a Workspace, so yes, it's related to #151.

Unfortunately, there is no API available _yet_ in VS Code for me to save Workspaces as a Project, unless doing it _manually_, which I'm avoiding to do. I'll wait a little while for the VS Code team to release that, otherwise, with enough support from the community/users, maybe I'll add it manually.

Hope this helps

Was this page helpful?
0 / 5 - 0 ratings

Related issues

andig picture andig  路  3Comments

mt-webdev picture mt-webdev  路  3Comments

johnbillion picture johnbillion  路  3Comments

wottpal picture wottpal  路  4Comments

frontcraft picture frontcraft  路  4Comments