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

Command handlers receive an empty object #42851

Closed
DonJayamanne opened this issue Feb 2, 2018 · 2 comments
Closed

Command handlers receive an empty object #42851

DonJayamanne opened this issue Feb 2, 2018 · 2 comments
Assignees
Labels
debt Code quality issues
Milestone

Comments

@DonJayamanne
Copy link
Contributor

  • VSCode Version: Code 1.19.3 (7c4205b, 2018-01-25T10:25:01.248Z)
  • OS Version: Darwin x64 17.4.0
  • Extensions:

Steps to Reproduce:
(create an extension)

  1. Create a VS Code command
  2. Register a command handler for the command
  3. Invoke the command from a command palette, and nothing is passed into the command handler. When invoked from a file or tree context menu then the file uri is passed.
  4. Add a keyboard shortcut to the above command
  5. However if the command is invoked via a keyboard shortcut, then an empty {} object is passed into the command handler.

Is this by design, to pass an empty object into the command handler when commands are invoked via the keyboard shortcuts.

@joaomoreno
Copy link
Member

joaomoreno commented Jun 1, 2018

@alexandrudima Instead of [{}], I now get [null], which I argue is still not ideal. But I've documented it in the Release Notes anyway. I'm too scared to change it to something else. 😆

joaomoreno added a commit to microsoft/vscode-docs that referenced this issue Jun 1, 2018
@alexdima
Copy link
Member

alexdima commented Jun 11, 2018

Good catch @joaomoreno

Turns out JS works differently than I would have thought when passing undefined as an argument in a function which uses var-args.

alexdima added a commit that referenced this issue Jun 11, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Jun 16, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
debt Code quality issues
Projects
None yet
Development

No branches or pull requests

4 participants