EditorSyntax
EditorSyntax copied to clipboard
Question: Interest in replacing build-grammar.js with a purely PowerShell solution?
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.
- 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+.
- In order to as closely match the formatting of the existing JSON file output, PowerShell 6.0+ is required, and a
-replaceoperation 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
@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.
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.
@msftrncs Thanks for the sample, I'm willing to go to a PowerShell build for language-powershell.