Steps to reproduce:
- Open an Adaptation project and from the command palette select action:
Adaptation project: Add SAPUI5 Component Usages.
- Fill the required fields in the form.
- Enter as a last step some valid key/value pair, e.g. "x": "y", inside the
Component settings or Component data text areas.
- While the text area is still focused press the Finish button.
As a result the key/value pair is never populated inside the changes file:
Expected result is to have the key/value pair populated inside the changes file:
{
"content": {
"componentUsages": {
"myComponentId": {
"name": "MyComponent",
"lazy": false,
"settings": {
"x": "y"
},
"componentData": {}
}
}
}
}
Workaround
If we move focus away from the text area after filling it in and then press the Finish button, the key/value pair is populated.
Root-cause analysis
It seems the problem is with the inquirer-gui. The component representing a prompt with type: editor(text area) is QuestionEditor.vue. The QuestionEditor uses vscode-textarea internally, which detects changes in the text content when the text area losses focus (blur or commit events). When we press the Finish button the text area will loose focus and the answers should be updated but this does not happen because the QuestionEditor component adds a debounce in the change handler which gets triggered after the occurrence of the press Finish button event, therefore the answerChanged event gets fired too late and the yeoman generator could not see the changes made in the text area.
This behavior does not apply for text inputs, for a prompt with type: input we have QuestionInput > vscode-textfield. The vscode-textfield fires change event when a new character is entered.
Steps to reproduce:
Adaptation project: Add SAPUI5 Component Usages.Component settingsorComponent datatext areas.As a result the key/value pair is never populated inside the changes file:
Expected result is to have the key/value pair populated inside the changes file:
{ "content": { "componentUsages": { "myComponentId": { "name": "MyComponent", "lazy": false, "settings": { "x": "y" }, "componentData": {} } } } }Workaround
If we move focus away from the text area after filling it in and then press the Finish button, the key/value pair is populated.
Root-cause analysis
It seems the problem is with the inquirer-gui. The component representing a prompt with type:
editor(text area) isQuestionEditor.vue. The QuestionEditor usesvscode-textareainternally, which detects changes in the text content when the text area losses focus (blur or commit events). When we press theFinishbutton the text area will loose focus and the answers should be updated but this does not happen because theQuestionEditorcomponent adds a debounce in thechangehandler which gets triggered after the occurrence of the press Finish button event, therefore theanswerChangedevent gets fired too late and the yeoman generator could not see the changes made in the text area.This behavior does not apply for text inputs, for a prompt with type:
inputwe haveQuestionInput > vscode-textfield. Thevscode-textfieldfires change event when a new character is entered.