Open aguerotSOVINTY opened 8 years ago
Good idea. I'll see what I can do.
@bpasero Is it actually possible to retrieve the currently selected file/directory? Can't seem to find an API method for this. If not, I'll create an issue in the vscode
issue tracker.
I haven't found a dedicated API either. As a workaround, how about we check for the window's activeTextEditor.document.fileName, if we find one we can set the generator's execution path to the current document folder otherwise we default back to the workspace rootpath?
@SamVerschueren no, I do not think there is API to get the selected folder of the explorer view.
@bpasero Would it be something could be considered? (e.g. should I create an issue for this)
@SamVerschueren for sure file an issue for it, not sure how high it would end up on our backlog though.
Done https://github.com/Microsoft/vscode/issues/3553
@aguerotSOVINTY I'd rather want to wait for VS Code to implement a solution.
At the moment when executing a generator within VSCode with vscode-yo, the root folder used by the generator is the project's root folder. It would be interesting to be able to use the current selected folder in the source explorer so that my generator doesn't have to know the target folder structure to generate items at the correct place.
For instance I have the following project struture opened in VSCode:
Root |- src | |- home | |- about |- test | |-etc
I want generated files to endup within a custom folder structure under the src folder.
The execution folder is always Root when running a generator. Therefore I have no other choice than handle in my generator the fact that I have to add an extra src folder. But then what about other projects structures where they have a different hierarchy?
It'd be nice to use the currently selected folder in Source Explorer as the generator's execution folder.