SamVerschueren / vscode-yo

Yeoman plugin for VS Code
MIT License
87 stars 15 forks source link

When VSCode is not opened on a folder, show a folder picker #21

Open bpasero opened 8 years ago

bpasero commented 8 years ago

It is possible to run Yo in VS Code when no folder is opened. In that case I suggest to either ask the user for the destination of where to install the generated files to or just inform that you first need to open a folder.

I would actually like to always be asked from where to run the generator (cwd) so that I am in charge where to install the generated files to. Currently it feels a bit weird that the files end up in my current workspace in a sub folder.

SamVerschueren commented 8 years ago

Maybe this can be added as an option? I don't want to select my cwd every time. But by adding option yo.askDestination: true or something like that offers flexibility to the user.

Do you have an small example on how to implement a folder selector popup?

bpasero commented 8 years ago

@SamVerschueren there is no good example for a folder picker I fear, but in Atom I saw something very simple: the picker opens and prefills the workspace you are in but you can type any other folder if you want. It does not really provide any other help (e.g. does not scan for your directories on disk). I think thats fine for now.

SamVerschueren commented 8 years ago

@bpasero So it was just a normal input box with a path like for example /Users/sam/Projects/playground/yo-test if a workspace is opened or empty if no workspace was opened and you could manually enter a path?

bpasero commented 8 years ago

@SamVerschueren actually what I saw was from the experience when you generate an extension in Atom, it would first ask you where to create the extension and this was happening through a quick-open-input-box similar to the one VS Code has for input. It was prefilling a path, but you chould change it.

I see that this is not ideal and actually you might want to file an issue to be able to ask for a file/folder path via the native picker, I think that would be the preferred solution.

SamVerschueren commented 8 years ago

@bpasero I just released 0.7.0 which shows an error message if no workspace is opened. If something like a file/folder picker is exposed to extensions, I will replace the error message with a picker.

bpasero commented 8 years ago

:+1: