Error: Edit is only valid while callback runs

Viewed 116

I am using showInputBox() to take input from the user in VsCode extension and using the edit.insert() method to display the result according to the user's input.

It is throwing error: Edit is only valid while callback runs.

Here is my code snipet:

vscode.window.showInputBox({placeHolder: 'number of paragraphs needed'}).then(value => { edit.insert(selection.start, randomPara(value));})

I want the edit text to work according to the input provided by the user.

I have also tried using await but it throws the error await is only valid in async function.

0 Answers
Related