Huuums/vscode-folder-templates

Global variables

jrmora opened this issue · 1 comments

It is not a bug but a new feature proposal:

Currently we can use customVariables for each template:

{
  "omitParentDirectory": true,
  "customVariables": ["varA=>X"]
}

But it will be really interesting to have global custom variables that we can set in the project (workspace) settings:
image

Check this scenario:

We use the same templates in different projects (libraries) therefore different workspace settings.
We achieve this by using an exclusive library for the templates imported on each project.

Here’s the important thing: Some variables are the same for the project and different for another project.

So we are forced to ask the variable value because we can not set a value by default for all the projects.
Thus, if you are in project A all the variable values in this project are X
If you are in project B all the variable values are Y
It could be reach setting customVariables globally. For example:

workspace settings for project A:

"folderTemplates.templateFolderPath": "node_modules/my-templates/src",
"folderTemplates.customVariables": ["varA=>XbecauseProjectIsA", "varB=>other1"]

workspace settings for project B:

"folderTemplates.templateFolderPath": "node_modules/my-templates/src",
"folderTemplates.customVariables": ["varA=>YbecauseProjectIsB", "varB=>other2"]

Thank you for the suggestion. I think this is a viable usecase and I will take a stab at this. Won't be before new years unfortunately but it will be coming.