If you are working with Power Query (aka M) and do more than single-line statements, you will frequently find yourself wishing for a powerful editor with proper syntax highlighting. Below I explain how to use Notepad++ for that purpose. While I use Power Query mostly in Power BI, it of course works just as well with other environments.
If you prefer watching over reading, check out the short video below. In it, I use DAX as an example. But it works just the same for M, of course.
First Things First
First Things First
- This guide is based on the 64-Bit Notepad++ version 8.4.2. You can always download the latest version of Notepad++ here.
- The same process works with the files for DAX over here.
To the right, you can download the custom language XML files for easy import into Notepad++ and further customization.
Follow the instructions below to
- enable syntax highlighting
- enable auto-completion
- modify the syntax colors to your liking
Get The Files
Let's Go
Auto Completion
This will give you syntax highlighting. If you want to have the auto-complete functionality, you need to
- navigate to the extracted folder
- enter the “AutoComplete” folder
- copy the file “m.xml” from the AutoComplete folder to the folder “autoCompletion” inside the Notepad++ program directory. In my case this is “C:\Program Files\Notepad++\autoCompletion“
- You will get a warning, requiring Administrator permissions.
- Confirm the warning and restart Notepad++
Modifying The Colors
I tried to pick colors that work equally well with the light and dark theme of Notepad++. However, colors that work well for me, might not be that great for you.
Fortunately, you can adapt them very easily. In Notepad++ click on Language, User Defined Language, Define your Language.
Select M from the User Language drop-down:
Version History
Version 4.01 - Sep. 16, 2022
- Fixed some formatting issues
Version 4.00 - Jul. 19, 2022
- Created completely new XML files for syntax highlighting and auto-completion
- Adjusted formatting to work with dark and light mode
- Made the syntax highlighting case-insensitive
- Separated AutoComplete from syntax highlighting to work with the new version of Notepad++