Closed hawkerm closed 4 years ago
@hez2010 I've been trying to work on a PowerShell script for the repo that can download TypedocConverter
and run it in order to generate the typings for anyone who wants to work on the project.
I'm not sure if I fully understand the steps. Would you mind outlining them for me here first? I'm happy to figure out how to automate them from there.
I imagine we need to have npm
and install typedoc
in order to run it on the monaco.d.ts
file somehow first? Then pass that output to your TypedocConverter
exe?
I've been trying to run the typedoc
command on the downloaded monaco.d.ts
file in the monaco-editor
directory, but it just keeps telling me Error: Cannot find module 'typescript'
?
Typedoc won't accept a .d.ts file as input, you need to rename monaco.d.ts to monaco.ts first.
Then,
typedoc monaco.ts --json monaco.json
TypedocConverter --inputfile monaco.json ...... # to more args use --help
Thanks @hez2010, I was able to get something generated on my box, awesome! 🙂
Apparently I needed to install the typescript
npm package as well for typedoc
to work, once I had that it worked fine with your command.
What arguments have you been using for TypedocConverter
? I tried this:
TypedocConverter.exe --inputfile .\monaco.json --splitfiles true --outputdir csharp --namespace ""
However, I noticed the generated files had the namespace prefix TypedocConverter.*
? It seems to do the same thing regardless of what I put for the namespace
parameter?
(Also, I noticed the AccessibilitySupport.cs
file didn't match the generated one, did we miss a change there?)
However, I noticed the generated files had the namespace prefix TypedocConverter.*? It seems to do the same thing regardless of what I put for the namespace parameter?
~I cannot repro it~ I can repro it with powershell, please use v1.5 release https://github.com/hez2010/TypedocConverter/releases/tag/v1.5 and try below command:
TypedocConverter --inputfile monaco.json --splitfiles true --outputdir . --promise-type WinRT
(Also, I noticed the AccessibilitySupport.cs file didn't match the generated one, did we miss a change there?)
Yes, we missed the change of AccessibilitySupport.cs, this file should be updated.
Thanks @hez2010, that was a huge help. I got the script to run and generate typings back into the project directory, it's pretty cool!
I just pushed 941cc8ea3afa745be2690e8d19f1694bb99beade to the prep branch which has a Node.js/PowerShell project which can generate the typing info.
It does appear to prefix the Newtonsoft.Json attributes and most files have a bunch of unused Monaco usings, but otherwise, it looks pretty clean now!
Should be a big to help to us both (and anyone else) that wants to copy any new typings over! 😊
@hez2010 ah, we're fine for the AccessibilitySupport. They have the enum, but they don't use it... :(
ahhh, an important thing is that currently TypedocConverter doesn't fully support type alias and union types in TypeScript, so that's why there's no generated class for ITextModel
. Under this circumstance TypedocConverter will generate warnings in the console.
TypedocConverter is a tool written by @hez2010 that reads a TypeScript definition file and generates C#. This is the new method to help us port APIs from Monaco to the wrapper.
It'd be great if we could add a new PowerShell script to the repo (like we have the
install-dependencies.ps1
already) that could take the monaco files pulled from the dependency script and output the Monaco types so we could easily add new APIs in the future.