While developing an extension for vscode, I encountered an error that I'm having trouble resolving. The goal is to create a script that generates a new file based on user inputs, but I'm running into an issue when trying to retrieve the path for the new file. Here's the relevant portion of the code:
let command3 = vscode.commands.registerCommand('command-bot.createFile', () => {
var fileName = vscode.window.showInputBox({
placeHolder: "Name your file"
});
var fileExt = vscode.window.showInputBox({
placeHolder: "What is the extension? Example: .py or .html"
});
const folderPath = vscode.workspace.workspaceFolders[0].uri.toString().split(":")[1];
//The code above caused the error! Error: Object is possibly 'undefined'
});