2

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.

Gama11
  • 31,714
  • 9
  • 78
  • 100
mdt
  • 139
  • 3
  • 17
  • Related: https://stackoverflow.com/questions/54926105/open-workspace-during-integration-testing-for-vscode-extension – Gama11 Jun 25 '19 at 20:49

0 Answers0