Skip to content

Trouble getting a save&close macro to work #55

@nguerrera

Description

@nguerrera

I wrote the following where my intent is to bind a key to save a document then close it:

"macros": {
    "saveAndCloseActiveEditor":  [
      "workbench.action.files.save",
      "workbench.action.closeActiveEditor"
    ]
  }

However, it doesn't work as I'd hoped as I still get prompted to save the document:

[Window Title]
Visual Studio Code - Insiders

[Main Instruction]
Do you want to save the changes you made to settings.json?

[Content]
Your changes will be lost if you don't save them.

[Save] [Don't Save] [Cancel]

Strangely, it's as though the closeActiveEditor didn't wait for save to complete. If I cancel that dialog, the document is actually saved from the prior macro run, and if I run it again, it will therefore be able to close without the prompt.

Any idea what's going on here and how I might get around it? Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions