I am trying to write unit tests that open a specific folder as a workspace, and then open a specific file and show it in the editor.
I tried using the vscode.openFolder
command to open the folder which worked, but I cant seem to be able to open files after that's executed.
vscode.commands.executeCommand("vscode.openFolder", wsUri);
const document = await vscode.workspace.openTextDocument(fileUri);
const editor = await vscode.window.showTextDocument(document);
also tried to open the file in then
vscode.commands.executeCommand("vscode.openFolder", wsUri).then(async () => {
const document = await vscode.workspace.openTextDocument(fileUri);
const editor = await vscode.window.showTextDocument(document);
});
The behavior is that the folder opens but after that the document does not. If I try to open the document without opening the folder, it opens. But I need to open the folder first.