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

Use file system structure for grouping #41

Open
jrich523 opened this issue May 28, 2019 · 5 comments
Open

Use file system structure for grouping #41

jrich523 opened this issue May 28, 2019 · 5 comments

Comments

@jrich523
Copy link

jrich523 commented May 28, 2019

The way i have my folders setup is like this

/repos/platform/org/repo

The platform is, for example, github/GHE/bitbucket etc

It would be awesome if i could set the repo's folder as my root and have it retain some of the folder structure (platform/org) for faster locating of projects. One of the problems I've had with it as it stands now is that i will commonly have a fork of a project

so these two paths could show up

repos/github/org/repo1
repos/github/jrich523/repo1

with how its setup now the tool tip shows "repo1" for both, making it hard to tell which is the original project and the fork.

I guess ideally i'd like to have a matching folder structure in VS Code to quickly pick and switch projects.

Also it seems like you're basing it off of a .vscode folder, which, if this is correct, would likely cause a problem with new clones (have to open by hand to create .vscode folder)?

anyways, i LOVE what you've done!
Thanks!

@fabiospampinato
Copy link
Owner

fabiospampinato commented May 30, 2019

with how its setup now the tool tip shows "repo1" for both, making it hard to tell which is the original project and the fork.

Are you talking about the statusbar item? Because you can configure the quick pick to show you the full path of the project, that seems something you'd want.

I guess ideally i'd like to have a matching folder structure in VS Code to quickly pick and switch projects.

Like, you want projects automatically organized based on their location in the file system?

Also it seems like you're basing it off of a .vscode folder, which, if this is correct, would likely cause a problem with new clones (have to open by hand to create .vscode folder)?

It should also detect git repos, and arbitrary projects can be added manually.

@jrich523
Copy link
Author

I guess i was thinking more of a Mouse over on the project, but the status bar is fine and i'll enable that.
Yes, I'd basically like it to mirror the folder structure.

I created a PowerShell script that will generate the json for the vscode_projects.json which works well but wont auto update.

The one thing I did notice after this setup was that when i navigate to the Project list, its always fully expanded (kind of annoying now)

I believe when i had it auto pick up it only found projects with a .vscode folder, however the script now bypasses this problem.

Here is the script i used to generate the json

$root = gi 'D:\Repos'
$results = [pscustomobject]@{
    groups = @()
    projects = @()
}

function processFolder {
param($folder, $data) 

    foreach($subfolder in (gci $folder.FullName -Directory -force:$false))
    {
        if(isProject $subfolder){
            $data.projects += new-project $subfolder
        }else{
            $g = new-pGroup $subfolder
            $data.groups += $g
            processFolder $subfolder $g 
        }
    }
}

function isProject {
param($folder)
## only checking for .git, probably worth checking a few more options
return (test-path (join-path $folder.FullName '.git'))

}

function new-project {
param($folder)
    [pscustomobject]@{
        name = $folder.name
        path = $folder.fullname
        icon = "code"
    }
}

function new-pGroup {
param($folder)
  [pscustomobject]@{
        name=$folder.Name
        description = "automated"
        icon = "globe"
        projects = @()
        groups = @()
    }
}

processFolder $root $results
$results | convertto-json -Depth 15

@fabiospampinato
Copy link
Owner

I guess i was thinking more of a Mouse over on the project

What project, those displayed in the activity bar view? We could very well add support for that. Currently we are displaying their descriptions in the tooltips.

Yes, I'd basically like it to mirror the folder structure.

We could add support for that in the future, it has been requested a few times already. If anybody would like to work on that I'd be happy to consider a PR.

Thanks for sharing the script.

@jrich523
Copy link
Author

Do you have an approach you'd like to take?
I've poked at the code and i have a decent grasp of it but im not very good at TS so i think i can probably do this if you give me an approach to handle it.

I think the refreshroots should work if perhaps i add a "retainFolders" or something like that to have that auto scan basically just pull in non-project folders as folders in the treeview.

The other thought was to have a new node type in the xml or add a property to the Group nodes to indicate auto population.

@fabiospampinato
Copy link
Owner

Sorry I don't really have time to provide much guidance on this right now, I'm not even sure it should be implemented.

What you should probably do is implement another "projects fetcher" https://github.com/fabiospampinato/vscode-projects-plus/blob/master/src%2Ffetchers%2Fprojects%2Fgit_tower.ts

But I'm not sure how that should work, in what group should fetched projects be put into? Should we always preserve the file system structure even if the project is found many levels deep? And what if the user doesn't want this behavior?

It might be a good idea to publish a separate projects manager built around this feature.

@fabiospampinato fabiospampinato changed the title Root Paths structure Use file system structure for groupin Aug 10, 2019
@fabiospampinato fabiospampinato changed the title Use file system structure for groupin Use file system structure for grouping Aug 10, 2019
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

2 participants