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

OpenDialog doesn't work on mac #40

Closed
devipv02 opened this issue Dec 3, 2019 · 6 comments
Closed

OpenDialog doesn't work on mac #40

devipv02 opened this issue Dec 3, 2019 · 6 comments

Comments

@devipv02
Copy link

devipv02 commented Dec 3, 2019

Hi,
Using vscode-extension-tester, I'm trying to do this 'workbench.executeCommand('Workspaces: Add Folder to Workspace...');' which opens a native dialog. I'm using
const dialog = await DialogHandler.getOpenDialog();
dialog.selectPath($WORKSPACE_PATH)
dialog.confirm();

This doesn't work and dialog stays open. Let me if this works in mac or any alternate approaches to open a folder/workspace in vscode. [I just need a way to add an empty folder to the vscode and from there i'm good testing my extension]

@jrichter1
Copy link
Collaborator

The dialog is indeed broken on mac, and I'm not quite able to get it working.

Therefore I am putting together a little extension to go along with the tester that would allow opening files/folders using a command. That should circumvent any need for open dialog and should be more stable in the end.

It shall be included into the next release.

@xorye
Copy link

xorye commented Dec 9, 2019

Hi, I've come across a similar problem. In my case, the extension I would like to test provides this functionality:

  • User calls a VS Code command through the command palette
  • Input box appears, user types in input, hits enter
  • the dialog appears, prompting the user to choose a folder

In this case, the dialog is opened by the vscode extension I am testing, so I think it would be amazing if Mac support was eventually added.

Is it an issue with the 'node-key-sender' npm module and its compatibility with Mac?

@jrichter1
Copy link
Collaborator

jrichter1 commented Dec 9, 2019

Is it an issue with the 'node-key-sender' npm module and its compatibility with Mac?

Very much so. Specifically this issue.

I understand the need for dialog handling, but so far I've failed to find a way to get it all working properly without writing it all myself.

@devipv02
Copy link
Author

devipv02 commented Dec 9, 2019

Hi, I'm able to get a workaround for this using robotjs on VSCode 1.40 [OSX 10.14.6]. This work well when i run my tests from Mac terminal, but fails when i run from VSCode terminal.

	var robot = require('robotjs');
	var ncp = require('copy-paste');  
        ncp.copy($PATH);   // Path to open folder
        robot.keyToggle("g", "down", ["command", "shift"]);
        robot.keyToggle("g", "up", ["command", "shift"]);
        robot.keyToggle("v", "down", ["command"]);
        robot.keyToggle("v", "up", ["command"]);
        robot.keyToggle("enter", "down");
        robot.keyToggle("enter", "up");
        robot.keyToggle("enter", "down");
        robot.keyToggle("enter", "up");

@jrichter1
Copy link
Collaborator

Robotjs definitely is a worthy alternative, but they have issues with newer versions of nodejs. As in I can't currently use robotjs with nodejs newer than version 8. Once they get a fix released, I'd be glad to try it out.

@jrichter1
Copy link
Collaborator

Fixed as per #56, hopefully :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants