alefragnani / vscode-project-manager

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

Support automatic detection of workspaces #334

Open gandalfsaxe opened 4 years ago

gandalfsaxe commented 4 years ago

With https://github.com/alefragnani/vscode-project-manager/issues/151 now workspaces can be saved as projects, which is great. However with git, I rely entirely on automatically detected projects in nested directories of one or more a master directories. It'd be great to have the same for .code-workspace files.

alefragnani commented 4 years ago

Hi @gandalfsaxe ,

I guess your comment in your previous issue would be the best solution to this. In fact, like folders that contains .vscode folder inside is recognized as a VS Code Project, the same goes for .code-workspace files.

But, I’m not sure if I would mix or create a new panel, exclusive to Workspaces. I think mix would work just fine.

What do you think?

gandalfsaxe commented 4 years ago

I'm inclined to think a mix would work fine, yes. If vscode project A and B are both in multi-workspace C, then it's fine to have them all listed and available when fuzzy-searching.

How does the system currently not duplicate projects that are folders containing both contains .git and a .vscode? Which is prioritized?

alefragnani commented 4 years ago

That’s great 👏 .

BTW, the priorization is: Favorites, VSCode, Git, Mercurial, SVN and Any. And it’s coded here:

https://github.com/alefragnani/vscode-project-manager/blob/834c8ae9f8520be0d464a5949b56ce48d91ce92a/src/extension.ts#L334

Hope this helps

gandalfsaxe commented 4 years ago

Thanks, makes sense.

mahyuan commented 4 years ago

If there are so much projects in sidbar, not easy to find. Really looking forward to add grouping functionality, show directory tree

alefragnani commented 4 years ago

Hi @mhy-web

Sometime ago, a “search field” has been requested (registered in #213) but the VS Code team closed the required API request, so I have to close the issue.

Looking again now, the API feature has been reopened (another issue https://github.com/microsoft/vscode/issues/70646) and maybe we will see it appear in the future (no ETA yet).

About grouping, it’s on my radar too :-)

carloscadux commented 2 years ago

Please, implement a functionality to indicate a base folders to search for .code-workspace files. This way I could uninstall other extensions for managing workspaces, and keep only 'Project Manager' to handle all the needs related to workspaces, folders and other project types managing. Thanks!

wottpal commented 2 years ago

Automatic workspace detection opening would be 🔥 (disturbs me every day that i open a project but forget to open the code-workspace and therefore vscode is running with different settings)

Let me know if I can help to get this done :)

wottpal commented 2 years ago

btw @alefragnani i just donated to the project (know that's by far not enough to value your work as it deserves)!

devantler commented 2 years ago

Supporting this would go well with my suggestion for the "new project" feature (see https://github.com/alefragnani/vscode-project-manager/issues/474#issuecomment-1167500867)

Then we can create, open and work with workspaces without any need to leave VSCode or to combine multiple commands.

alefragnani commented 2 years ago

Hi @wottpal,

First of all, thank you for your donation! Your support is very important!

About your previous comment, I wonder if your scenario is a bit different from the original request.

I mean, this issue is to auto detection of workspaces within some baseFolders, similar to how Git repos and VS Code projects are automatically detected (folders with a .vscode subfolder) and becomes available in Project Manager: List Projects to Open command. Your comment, on the other hand, seems you would like VS Code to automatically detect if an opened folder contains a .code-workspace file, and instead of opening the folder (that you requested) it automatically switches to the .code-workspace. Am I right?

If that's the case, I wonder if VS Code itself wouldn't handle it, as think it's a great feature. I don't use Workspaces that much, but from time to time I'm opening a few of them. BTW, I didn't find anything in VS Code issues. Nevertheless, I guess this could also be added the the extension, but of course, it would work only if the folder is opened using the extension.

Hope this helps

wottpal commented 2 years ago

Many thanks for the clarifications, @alefragnani! ❤️

To be honest I would love to see both features:

  1. Detecting project-folders with workspaces in them. (But in this case, it would be important for me that workspace-detected folders take precedence/priority compared to git-detected ones. As I don't want to turn off git-detection and don't want a project-list full of duplicates).

  2. 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.

Let me know how we best proceed with those, I can also open a new issue in this repo and/or even help with implementation (but I've never developed vscode-extensions before unfortunately)

alefragnani commented 2 years ago

Hi @wottpal ,

Just to let you know, I opened #617 to track your second suggestion.

About your first suggestion, the extension has the groupList setting, which creates a kind of precedence between each kind of project. But I suggest you leave it false and play with sortList setting. It will ignore the kind of project and sort them by Name, Path or Recent. You will know its kind only because the icon attached to it.

Hope this helps

saminton commented 1 year ago

Any news on this ? I would love to see workspace support

wottpal commented 1 year ago

Hey @saminton / @alefragnani, as i wanted to explore building vscode extensions myself anyway, i took the chance and built a small one myself. it shows all available workspace files when opening a directory with vscode. it also can be configured to open the found workspace file automatically.

➡️ https://marketplace.visualstudio.com/items?itemName=zoma.vscode-auto-open-workspace

MarkCanada commented 1 year ago

Hey @saminton / @alefragnani, as i wanted to explore building vscode extensions myself anyway, i took the chance and built a small one myself. it shows all available workspace files when opening a directory with vscode. it also can be configured to open the found workspace file automatically.

➡️ https://marketplace.visualstudio.com/items?itemName=zoma.vscode-auto-open-workspace

Takes "a bit" to open the workspace since it's not integrated into the projects, but happy to say that it worked for me - even with the .code-workspace file "hidden" in the .vscode folder 👍

wottpal commented 1 year ago

Thanks for your feedback, @MarkCanada! Really appreciate that someone tried it out. Opened an issue about this: https://github.com/wottpal/vscode-auto-open-workspace/issues/1. Happy for any help/suggestions as I do not have many ideas on how to improve it right now.

MostHated commented 1 year ago

I am not sure if I am a bit too late to the party, but I had a request. I was hoping the be able to specify a custom file which would be used to determine if a folder is a project or not. All of my current projects contain a file named ".project.nvim", which my Neovim project manager uses to determine if a folder is a project or not and acts as the project root. It would be nice to be able to simply add that file name into a list that the VSCode project manager can use, then treating folders containing a filename from that list as projects automatically, instead of having to maintain multiple project lists which depend on different meta files.

An example might look like the following:

  "projectManager.any.projectIndicatorFilename": [
    ".project.nvim",
    ".code-workspace"
  ],

Thanks!
-MH