Useful extension. Some misc feedback/ideas.
I just gave this a shot and I have to say that it's very neat. Kudos! I have some feedback though
- Add a setting for
ProjectTemplates.ignore- files and folders to ignore when creating a project from template. Currently I have a template that I'd like to keep in git but if I do that, then when creating project from git, even the.gitand other files will be restored. - I got tripped by the default regex which uses
\w+. I didn't pay attention and declared a couple of variables likeespidf-tools- nevertheless, those did not get replaced and I was left scratching my head. I suggest to change the default to.+?(greedy quantifier) - like so:"projectTemplates.placeholderRegExp": "#{(.+?)?}", - For default placeholders vars, allow them to be overridden at project creation time if the value ends with a
?(or some other pattern, with the prompt auto filled with the remaining value. This will aid in making templates reusable across machines. - (more sophisticated version of 3) This might be a little more complex and involve feature creep - expression support for default placeholders. For ex:
"projectTemplates.placeholders": {
"espidf" : "$env.IDF_PATH:?",
"espidf-tools": "/data/common/esp32/xtensa-esp32-elf"
}
In the above, espidf will have the value of the env var IDF_PATH (if defined). The ":?" at the end is a marker to prompt the user when project is created.
-
Sometimes you may want to copy an initialized git repo. This was something I thought about, but decided to keep it simple. Just delete the git folder from the template after-the-fact if you don't want to do it before.
-
I'm open to that suggestion. Will think about it some more, thanks.
3/4. Can you give a more concrete example with workflow? I'm not sure I follow.
For 3 & 4, the idea is to allow env based value lookup for template params with the ability to override it when creating a project. Workflow is exactly the same - user needs to define template vars in settings or enter it each time - but now for the ones where the value is looked up via an expression, the prompt is prefilled with the value when the project is created and the user can just click through or edit
I see, so you want the ability to use the default as a suggestion (i.e. pre-populate the input box) but be given the opportunity to override it if the suggestion ends with a question mark. I can get behind that.
Yeah - exactly that. And allow the default to be a basic expression (env var, shell ex etc) - would help portability of project templates immensely.