Latest Enterprise DNA Initiatives

External Tool to edit Power Query code in Visual Studio Code

@BrianJ

I’ve finally had a moment to make this tool. Do you want to give it a whirl?

It requires this extension to be installed in VSCode which can be searched for in the addons menu.
https://marketplace.visualstudio.com/items?itemName=PowerQuery.vscode-powerquery

It creates temporary PQ files, cleaning out anything older than 7 days, and launches VSCode via the association with .pq files.

3 Likes

@samaguire,

Thanks! This is really cool. Just want to make sure I’m using it correctly though - I’m opening advanced editor, copying my code, activating the external tool and then pasting my M code into VSC, and then doing it in reverse to run the revised code, correct?

  • Brian

(Posting against the right thread this time.)

Hi @BrianJ

That’s correct! You can also copy from the formula bar and then paste back into the formular bar if you are just working on one step - which is mostly what I’m doing as it’s a custom step I’m working on.

The only gotchya with working with code from the formula bar is that VSCode identifies that the syntax is incorrect if you leave the leading ‘=’ in (which it technically is). Like is shown in this screen shot.

When I get rid of the leading ‘=’ I can then code as normal, using Shift + Alt + F to apply formatting.

The only drawback is that you need to type column/step names as intellisense doesn’t pick this up from your Power Query instance. (But this is true of all the other tools I’ve seen outside of the PBID editor as well.)

2 Likes

I made some tweaks. Latest version at:

1 Like