vscode-project-manager icon indicating copy to clipboard operation
vscode-project-manager copied to clipboard

Support automatic detection of workspaces

Open gandalfsaxe opened this issue 5 years ago • 18 comments

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.

gandalfsaxe avatar Feb 26 '20 19:02 gandalfsaxe

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?

alefragnani avatar Feb 26 '20 22:02 alefragnani

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?

gandalfsaxe avatar Feb 26 '20 23:02 gandalfsaxe

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

alefragnani avatar Feb 27 '20 02:02 alefragnani

Thanks, makes sense.

gandalfsaxe avatar Feb 27 '20 16:02 gandalfsaxe

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

mahyuan avatar Mar 02 '20 08:03 mahyuan

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 :-)

alefragnani avatar Mar 02 '20 13:03 alefragnani

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!

carloscadux avatar Mar 02 '22 15:03 carloscadux

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 avatar May 26 '22 12:05 wottpal

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

wottpal avatar Jun 24 '22 13:06 wottpal

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.

devantler avatar Jun 27 '22 15:06 devantler

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

alefragnani avatar Jun 28 '22 01:06 alefragnani

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)

wottpal avatar Jun 28 '22 12:06 wottpal

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

alefragnani avatar Jun 29 '22 20:06 alefragnani

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

saminton avatar Oct 04 '22 14:10 saminton

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

wottpal avatar Oct 05 '22 07:10 wottpal

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 👍

MarkCanada avatar Feb 02 '23 23:02 MarkCanada

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.

wottpal avatar Feb 03 '23 07:02 wottpal

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

MostHated avatar Feb 08 '23 03:02 MostHated