lostintangent / gistpad

VS Code extension for managing and sharing code snippets, notes and interactive samples using GitHub Gists
https://aka.ms/gistpad
MIT License
937 stars 58 forks source link

Copy folders/files into local workspace #346

Open mkvlrn opened 8 months ago

mkvlrn commented 8 months ago

Is your feature request related to a problem? Please describe. I want to be able to copy the gist (entire folder strucuture, if there is one) into my local folder. Currently I need to copy the contents of every file and paste into a manually created one.

It was asked in an unanswered Discussion Q&A and there was a possible solution/PR mentioned, but it was never merged.

Describe the solution you'd like Something like this PR that was closed without being merged because the author decide to mantain a clone of the extension with these changes.

Describe alternatives you've considered Using said clone extension, but I rather use the official one.

Additional context N/A

lostintangent commented 8 months ago

Could you share a bit more detail about the way you'd expect to use this? Syncing files between your local file system and gists is out of scope for this extension, but it could be simple to allow downloading the contents of a gist (and then expecting the user to do any content sync if needed).

mkvlrn commented 8 months ago

Thank you for the reply!

So for some groups of files I use gitsts instead of repositories because these files are very reusable among all types of repositories I could create, and sometimes I'm just doing some local experimentation without creating a new repository, and grabbing files from a gist is just what I need.

Like this, for example:

I have a gist containing a .vscode folder with a settings.json file in it, and some other boilerplate files outisde that folder, like an .editorconfig and biome.json. It's sort of a template but not fully fleshed out, just parts that I like to plug into a new bun project, or a node project.

gist
|__ .vscode/
|   |__ settings.json
|__ .editorconfig
|__ biome.json

So after starting the project with bun init and some other steps, I want to pull all files from the gist and put them in the root of my project.

Just downloading the gist (with folder structure intact, if possible) to my open workspace would do.

lostintangent commented 8 months ago

Ah I see, that makes a lot of sense. In your case, it seems like you'd always want to copy the gist files to the root of your currently opened workspace?

To make this more general, I suppose we'd need to check and see if a file already existed, and ask the user if they wanted to overwrite it.

And also, I wonder if we need to ask which directory to download the files to, as opposed to just assuming it's the workspace directory.

mkvlrn commented 8 months ago

To make this more general, I suppose we'd need to check and see if a file already existed, and ask the user if they wanted to overwrite it.

Oh yes, that could be very handy!

And also, I wonder if we need to ask which directory to download the files to, as opposed to just assuming it's the workspace directory.

In my case I would create the structure of the gist that would mirror the root of a new project, but yes, now that you mention it, I can see someone just using the gist as a "basket for a bunch of files" and having the option to select where to put said files is a great idea.