Open erapade opened 4 years ago
As a diehard Power Query fan, I'll say that I'm a bit more hesitant on this one. DAX Formatter is easy because in theory there won't be sensitive items (Table / Column Names being the most exposed risk) whereas Power Query could potentially include keys, server addresses, etc. and with a web service which I have used but with extreme caution prior to the VS Code extension - this functionality would just need to be well thought of ahead of time and if using the official Microsoft code base is a possibility even better.
@itsnotaboutthecell is correct. It's not a good idea to send random M-expressions over the wire. I am looking into implementing a simple M parser for formatting purposes on my own, but I can't provide any timeline for now (I'm aware of the official open source M parser from Microsoft, but unfortunately, that was written in TypeScript, so it can't be easily integrated in Tabular Editor).
Good comments. So a .NET WinForms (C#) fork of the currently official open source M parser from Microsoft would be nice to have ;-)
Not necessarily WinForms, but .NET-compatible for sure. Alternatively, an ANTLRv4-based grammar (from which I can easily generate a lexer and parser).
There was already an open request for Power Query M on ANTLRv4. Just adding it to this thread if/when anyone having knowledge and/or time to pick it up: https://github.com/antlr/grammars-v4/issues/1399
I checked the open source M parser @otykier referred to earlier and looked at the dependents: https://github.com/microsoft/powerquery-parser/network/dependents. Maybe this is not a dead end. One of the dependents are the VS M-code plugin: https://github.com/microsoft/vscode-powerquery
This is totally out of my comfort zone, but it looks like this is a server that as a last step can be a vsix package for VS Code. But I guess that this service can be used by any application, e.g. the Tabular Editor. As I said, totally out of my comfort zone, but maybe the easiest path to go. And as long as Microsoft are supporting the M-code plugin in VS Code, this service will hopefully be up to date with all new changes to the M-code specification
Today we have the dax formatter available, but why not also start to support the power query formatter at https://powerqueryformatter.com/
It's currently only in Beta and I'm not sure their views on open source since the GIT repository haven't been updated since April while there are new releases after that date. But having it available from within the Tabular editor might put a greater attention on the development, so please have a chatt with them