This will allow you to provide a function when declaring the prompt for the prompt field. The function should return a string that will be used in the final prompt. The function is called every time a generate call is issued. Variables still work on the output string.
I gave the function one argument, a table of properties that are in scope relevant the interpolation of the prompt, should you want to do manual interpolation.
The purpose is to enable dynamic prompt generation that is more flexible than just the variable system. A few examples:
insert additional vim.ui.input calls to ask for more information about how to fill out the prompt
automatically insert context on the prompt depending on the current file or directory.
implement custom $variables in a prompt template string
This will allow you to provide a function when declaring the prompt for the
prompt
field. The function should return a string that will be used in the final prompt. The function is called every time a generate call is issued. Variables still work on the output string.I gave the function one argument, a table of properties that are in scope relevant the interpolation of the prompt, should you want to do manual interpolation.
The purpose is to enable dynamic prompt generation that is more flexible than just the variable system. A few examples:
vim.ui.input
calls to ask for more information about how to fill out the prompt$variables
in a prompt template string