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

Support VS Code Multi-root Workspaces #149

Closed
alefragnani opened this issue Oct 15, 2017 · 13 comments
Closed

Support VS Code Multi-root Workspaces #149

alefragnani opened this issue Oct 15, 2017 · 13 comments
Assignees
Milestone

Comments

@alefragnani
Copy link
Owner

No description provided.

@bpasero
Copy link

bpasero commented Oct 16, 2017

@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

@alefragnani alefragnani added good first issue Good for newcomers and removed good first issue Good for newcomers labels Oct 17, 2017
@alefragnani
Copy link
Owner Author

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.

@bpasero
Copy link

bpasero commented Oct 17, 2017

@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 microsoft/vscode#35407 opened to track this request.

@alefragnani
Copy link
Owner Author

@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

@alefragnani
Copy link
Owner Author

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

@alefragnani alefragnani added this to the 0.23.0 milestone Oct 27, 2017
@brandonb927
Copy link

Just stumbling in here because I was interested in the feature, looks like multi-root folders has landed in Stable 🎉 microsoft/vscode#396 (comment)

@alefragnani
Copy link
Owner Author

It's almost there 👍

@ClementVidal
Copy link

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 ?

@alefragnani
Copy link
Owner Author

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

@andy-blum
Copy link

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.

@alefragnani
Copy link
Owner Author

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

@andy-blum
Copy link

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

@alefragnani
Copy link
Owner Author

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

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

No branches or pull requests

5 participants