Fixing the PoSh Hotkey in ADS

I installed the PowerShell (PoSh) extension in ADS recently. This is available in the extension pane, and once installed, you get the 4th icon on the right added to your sidebar, for PoSh.

2020-09-10 15_07_51-poshtest.ps1 - Data Analysis - Azure Data Studio

I have the SSMS Keymap extension installed as well, since that was the first one I grabbed. This gives me keymapping to allow CTRL+E to execute queries. I have literally a decade of muscle memory here, and really wanted this to work.

However, when I highlight code in ADS and press F8, which is what I do in VS Code, I get this:

2020-09-11 14_42_34-poshtest.ps1 - Data Analysis - Azure Data Studio

Not only is my PoSh code in the editor tab not executed in the Terminal, but the Server Connection pane pops open.

This is because that’s what keymap does for F8. I can use the command palette to debug this.

2020-09-11 14_44_14-Keyboard Shortcuts - Data Analysis - Azure Data Studio

If I open up the keyboard shortcuts and search for F8, I find that a number of things use this.

2020-09-11 14_44_21-Keyboard Shortcuts - Data Analysis - Azure Data Studio

The last binding is the one that’s in effect, and you can see that the Show Connections overrides the PowerShell item.

Fortunately, I can edit this by clicking on the left of this line.

2020-09-11 14_45_41-Keyboard Shortcuts - Data Analysis - Azure Data Studio

Once the dialog pops up, it is there to capture any keystrokes, so it’s hard to get a picture of this. However, with a little experimenting, I remapped this to CTRL+L, which has some bindings, but these aren’t ones I use.

Now I see PowerShell as the last item, and if I close this tab, and go back to my code, I can press F8, and I’ll see the line executed in the terminal.

2020-09-11 14_47_45-poshtest.ps1 - Data Analysis - Azure Data Studio

About way0utwest

Editor, SQLServerCentral
This entry was posted in Blog and tagged , , . Bookmark the permalink.