EditorSyntax icon indicating copy to clipboard operation
EditorSyntax copied to clipboard

Question: Interest in replacing build-grammar.js with a purely PowerShell solution?

Open msftrncs opened this issue 6 years ago • 3 comments
trafficstars

Would there be any interest in replacing the build-grammar.js script (in tools) with a purely PowerShell based solution? I have created a script/function/class that provides the equivalent of 'fast-plist' using the .NET XML reader and a PowerShell script (using a class) to 'ConvertFrom-Plist'.

Two caveats.

  1. For performance reasons, I used a class, due to the fact that the inner function is highly recursive. The class with static method improved performance in excess of 4:1. This limits to PowerShell 5.0+.
  2. In order to as closely match the formatting of the existing JSON file output, PowerShell 6.0+ is required, and a -replace operation to replace the space indent with tabs.

Reference: https://github.com/msftrncs/PwshReadXmlPList

https://github.com/msftrncs/EditorSyntax/blob/build_grammar.ps1/tools/build-grammar.ps1

msftrncs avatar Feb 15 '19 07:02 msftrncs

@jrsconfitto, I've also included a sample for converting to CSON as well:

https://github.com/msftrncs/EditorSyntax/blob/build_grammar.ps1/tools/build-atomGrammar.ps1

https://github.com/msftrncs/PwshOutCSON

The link to the ConvertFrom-Plist function has been updated above.

msftrncs avatar Mar 03 '19 18:03 msftrncs

I think this is a good idea. Eventually we should make all the scripts and tests in PowerShell/.NET so we're on one stack.

TylerLeonhardt avatar Mar 03 '19 19:03 TylerLeonhardt

@msftrncs Thanks for the sample, I'm willing to go to a PowerShell build for language-powershell.

jrsconfitto avatar Mar 12 '19 12:03 jrsconfitto