I tried to open folder first in new VScode window and then open file in same VScode window, but the folder is opening and the file is not opening. For reference I tried like this. It will be great if you provide any suggestion to handle this case.
Here is my code, how i tried.
Case1: Only folder is opening.
let uri = vscode.Uri.file(apiPath);
await vscode.commands.executeCommand("vscode.openFolder", uri, {
forceNewWindow: true,
}).then(async function(){
let filePath = vscode.Uri.file(path.join(apiPath, "Abc.java"));
await vscode.commands.executeCommand("vscode.open", filePath);
})
Case2: Both folder and file is opening but in different VScode windows.
let uri = vscode.Uri.file(apiPath);
await vscode.commands.executeCommand("vscode.openFolder", uri, {
forceNewWindow: true,
});
let filePath = vscode.Uri.file(path.join(apiPath, "Abc.java"));
await vscode.commands.executeCommand("vscode.open", filePath);