vscode-project-templates icon indicating copy to clipboard operation
vscode-project-templates copied to clipboard

Useful extension. Some misc feedback/ideas.

Open raghur opened this issue 6 years ago • 4 comments

I just gave this a shot and I have to say that it's very neat. Kudos! I have some feedback though

  1. 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 .git and other files will be restored.
  2. I got tripped by the default regex which uses \w+. I didn't pay attention and declared a couple of variables like espidf-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": "#{(.+?)?}",
  3. 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.
  4. (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.

raghur avatar May 22 '19 13:05 raghur

  1. 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.

  2. 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.

cantonios avatar Jun 15 '19 19:06 cantonios

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

raghur avatar Jun 17 '19 08:06 raghur

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.

cantonios avatar Jun 18 '19 21:06 cantonios

Yeah - exactly that. And allow the default to be a basic expression (env var, shell ex etc) - would help portability of project templates immensely.

raghur avatar Jun 19 '19 03:06 raghur