Creating an Atom Grammar Language Package for M Power Query Formula Language

I was sick of using Atom for Power Query without auto completion or syntax highlighting so I'm building an Atom Grammar package for M

me@jaykilleen.com wrote this about 7 years ago and it was last updated about 7 years ago.


← Back to the Posts

If you have had a read of this site already then you will know my frustrations managing queries using git so I thought I'd try to take some pain out by bringing in Snippets and Syntax Highlighting using a Grammar Package in Atom.

First I followed the steps to create a new package in Atom after doing some Googling and stumbling across this post and the Atom Flight Manual.

Then create a symbolic link in the atom package directory to the folder structure that I am using for my source control. I like to build things visually and I was learning Regex while doing this so needed to see how the package was working whilst I was developing it.

Originally I did this using command line with admin rights in Windows but this turned out to be unnecessary. All the commands below were replaced simply by running the apm link command from the package directory using Git Bash. Read More Here

C:\Users\jaykillen\.atom\packages>
  mklink 
  /D 
  "C:\Users\jaykilleen\.atom\packages\language-m" 
  "C:\Users\jaykilleen\Projects\atom-language-m"

  symbolic link created for 
    C:\Users\jaykilleen\.atom\packages\language-m 
    <<===>> 
    C:\Users\jaykilleen\Projects\atom-language-m

Now that I had those steps it was time to head over to PluralSight for an introducing to Regex's and start hacking at the Grammer -> m.cson file to start coming up with some pattern matching.

Next was the snippets. Same deal, go to the Snippets -> m.cson and start hacking.

I cloned the following packages from Github so that I could follow some best practice and to get my head around it all:

  • language-ruby
  • language-rust
  • language-vb
  • language-csharp

I was also aware of some existing projects in older editors like Notepad++ like:
Notepad Language File for the Power Query Formula Language by Matt Masson
Power Query Editor Using Notpad by Lars Schreiber

I've managed to get a version 0.0.0 commited to Github.

Things I am struggling with:

  1. Learning complex regexes but that is part of the learning. PluralSight is helping with that
  2. Understanding the Atom CSS patterns so that Regex can get matched to standard themes
  3. Understanding complicated Grammar pattern matching. Looks like a lot of nesting and includes happening in places like rust and ruby
  4. Understanding the range of functions available in M and how I will find the time to process through them all

Once I have spent some time on the package I'll circle back and share some more...

Similar