Skip to content
Dave Grochocki edited this page Sep 2, 2022 · 3 revisions

In tasks.json, add the following entry:

{
      "label": "xstyler",
      "type": "shell",
      "command": "xstyler -f ${file}",
      "problemMatcher": []
}

Then in the keybindings.json, you can map the task to a key combination:

{
      "key": "ctrl+shift+a", // This can be your own keybinding of choice
      "command": "workbench.action.tasks.runTask",
      "args": "xstyler",
      "when": "resourceExtname == '.xaml'"
}

When the task runs, it also saves the file, so you can also use it as an alternative key binding to save XAML files.

For non-Windows OS, change the command to include dotnet in the beginning.