alefragnani / vscode-project-manager

Project Manager Extension for Visual Studio Code
GNU General Public License v3.0
1.94k stars 223 forks source link

[FEATURE] - Suggest to open `.code-workspace` when opening projects that contains workspaces in its root #617

Open alefragnani opened 2 years ago

alefragnani commented 2 years ago
  1. And again, as you understood correctly, the auto-opening of a workspace whenever a folder containing one was opened. I would love to see this as a feature of this plugin as I think this is a good fit but I could also imagine creating a vscode-issue (though i have no big hopes of getting that through soon). And the restriction you mentioned, that this only works if a folder is opened through the extension, is perfectly fine for me as I open all my projects with your extension only.

Originally posted by @wottpal in https://github.com/alefragnani/vscode-project-manager/issues/334#issuecomment-1168635540

D35 commented 2 years ago

I have found that editing the project.json file and providing the folder and the name of the ".code-workspace" file name in the "rootPath" works well. But this does not seem to be covered in the documentation.

I did not find any documentation for the project.json "Paths" setting either.

wottpal commented 2 years ago

Thanks for the heads up, @D35. Unfortunately, I'm not using the manual project.json but the automatic detection instead. So I guess this would not work in my case.

alefragnani commented 2 years ago

@D35 , thanks for helping, but @wottpal scenario is a bit different. He wants VS Code to suggest opening the .code-workspace, when you open a regular folder.

BTW, the support to .code-workspace is documented in extension’s readme, as the Save Project command describe to support folders and workspaces. Ok, maybe it is not explicit that it means a .code-workspace file, but I try to follow VS Code descriptions as much as possible.

If you think the documentation could be improved somehow, please open a new issue or add some comments to #394, which was opened requesting a Tutorial to the extension.

I’m also planning a Walkthrough #517, which should be available in upcoming releases

Hope this helps

Natetronn commented 1 year ago

I just hit this issue and was about to make a feature request to open workspace if a .code-workspace is present, else open folder (as is the current default.) When opening a project from my favorites of this extension, I currently see the following message:

workspace

I'd like for it to just open the workspace directly and not ask me (I'm assuming this message is a vscode (proper) message.)

The great thing about workspaces is that any previously opened files, either saved or unsaved, are opened as well and our files/folder tree is in a state where we left it. With that, we're able to continue from where we left off with ease. Opening a folder, on the other hand, has no history.

Anyway, I didn't see this option in the extensions Settings when I check for one, but I'll take a look at the readme and see if I can get it to use the workspace instead.

ETA

Okay, according to the readme, if you open a workspace and Save Project it will save it as a workspace. If you open the project as a folder, it will save it as a folder. I opened the project using the list of git repos, the ones that are listed in this extension below favorites and that's how I ended up having a folder open and not a workspace (not how I would normally open a project, but I was using the extension.)

Anyway, I guess that would be a different features request i.e. open git repos as workspace if project has a .code.workspace file or if is a project that has a rootPath that points to a .code.workspace, else open as folder.

wottpal commented 1 year ago

Hey @Natetronn, as I had the exact same need, I developed a small plugin to do exactly this: https://marketplace.visualstudio.com/items?itemName=zoma.vscode-auto-open-workspace

Please also see this discussion for reference.

Natetronn commented 1 year ago

Hey @Natetronn, as I had the exact same need, I developed a small plugin to do exactly this: https://marketplace.visualstudio.com/items?itemName=zoma.vscode-auto-open-workspace

Please also see this discussion for reference.

@wottpal thanks for sharing! I gave it a try on two projects. One project's workspace was found and the other was not, even though both had a workspace file in root of the project. I'm not sure the difference or why one worked and the other didn't, but, either way, maybe we should take this conversation to auto-open-workspace at this point, since it's probably slightly off topic now. Shall I open an issue on your repo?

wottpal commented 1 year ago

@Natetronn yes, please do so :)