Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

openTextDocument after opening a folder #76106

Closed
mdt123 opened this issue Jun 25, 2019 · 2 comments
Closed

openTextDocument after opening a folder #76106

mdt123 opened this issue Jun 25, 2019 · 2 comments
Assignees
Labels
*as-designed Described behavior is as designed

Comments

@mdt123
Copy link

mdt123 commented Jun 25, 2019

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.

@jrieken jrieken assigned bpasero and unassigned jrieken Jun 25, 2019
@bpasero bpasero added the *as-designed Described behavior is as designed label Jun 26, 2019
@vscodebot
Copy link

vscodebot bot commented Jun 26, 2019

The described behavior is how it is expected to work. If you disagree, please explain what is expected and what is not in more detail. See also our issue reporting guidelines.

Happy Coding!

@vscodebot vscodebot bot closed this as completed Jun 26, 2019
@bpasero
Copy link
Member

bpasero commented Jun 26, 2019

Requiring a window reload when opening a folder is unfortunately a limitation we cannot lift easily. You cannot write a test today that opens a folder first and then executes code, also because the extension host will restart (related: #69335)

@vscodebot vscodebot bot locked and limited conversation to collaborators Aug 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*as-designed Described behavior is as designed
Projects
None yet
Development

No branches or pull requests

3 participants