Visual Studio Code is a free, lightweight code-editing tool from Microsoft that's available on all platforms (Windows, Mac, Linux). Power Query M Language is an extension to Visual Studio Code that provides code-editing support for M queries, as shown in the following screenshot:

In this example, the same Internet Sales query viewed in the Advanced Editor of Power BI Desktop has been copied into a Visual Studio code file and saved with a (.pq) file extension. Once saved in a supported file extension, code-editing features, such as colorization, auto-closing, and surrounding detection, are applied. M query files can be opened and saved with the following four file extensions—.m, .M, .pq, and .PQ.
In the initial release of the extension (v 1.0.0), IntelliSense is limited to the terms within the query. Future updates will likely include IntelliSense support for the standard library of M functions and common M syntax, similar to the Power Query SDK for Visual Studio. To install the Power Query M Language extension for Visual Studio Code, open the Extensions Marketplace in Visual Studio Code (View | Extensions) and search for the name of the extension.