Skip to content

Commit

Permalink
Added initial support for generate constructors (Fixes #10)
Browse files Browse the repository at this point in the history
  • Loading branch information
hez2010 committed Apr 12, 2020
1 parent 064d043 commit acf2960
Show file tree
Hide file tree
Showing 8 changed files with 279 additions and 254 deletions.
41 changes: 29 additions & 12 deletions TypedocConverter.Test/test.expected
Original file line number Diff line number Diff line change
Expand Up @@ -5098,18 +5098,6 @@ namespace TypedocConverter.Monaco.Editor
/// </summary>
interface ITextModel
{
/// <summary>
/// A unique identifier associated with this model.
/// </summary>
[Newtonsoft.Json.JsonProperty("id", NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
string Id { get; set; }

/// <summary>
/// Gets the resource associated with this editor model.
/// </summary>
[Newtonsoft.Json.JsonProperty("uri", NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
Uri Uri { get; set; }

/// <summary>
/// An event emitted when the contents of the model have changed.
/// </summary>
Expand Down Expand Up @@ -5140,6 +5128,18 @@ namespace TypedocConverter.Monaco.Editor
/// </summary>
event System.Action OnWillDispose;

/// <summary>
/// A unique identifier associated with this model.
/// </summary>
[Newtonsoft.Json.JsonProperty("id", NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
string Id { get; set; }

/// <summary>
/// Gets the resource associated with this editor model.
/// </summary>
[Newtonsoft.Json.JsonProperty("uri", NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
Uri Uri { get; set; }

/// <summary>
/// Edit the model without adding the edits to the undo stack.
/// This can have dire consequences on the undo stack! See @pushEditOperations for the preferred way.
Expand Down Expand Up @@ -7923,6 +7923,11 @@ namespace TypedocConverter.Monaco.Languages

class FoldingRangeKind
{
/// <summary>
/// Creates a new [FoldingRangeKind](#FoldingRangeKind).
/// </summary>
public FoldingRangeKind(string value) => throw new System.NotImplementedException();

[Newtonsoft.Json.JsonProperty("value", NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Value { get => throw new System.NotImplementedException(); set => throw new System.NotImplementedException(); }

Expand Down Expand Up @@ -10843,6 +10848,8 @@ namespace TypedocConverter.Monaco

class CancellationTokenSource
{
public CancellationTokenSource(CancellationToken parent) => throw new System.NotImplementedException();

public void Cancel() => throw new System.NotImplementedException();

public void Dispose(bool cancel) => throw new System.NotImplementedException();
Expand All @@ -10865,6 +10872,8 @@ namespace TypedocConverter.Monaco
/// </summary>
class Emitter<T>
{
public Emitter() => throw new System.NotImplementedException();

[Newtonsoft.Json.JsonProperty("event", NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public IEvent<T> Event { get => throw new System.NotImplementedException(); set => throw new System.NotImplementedException(); }

Expand Down Expand Up @@ -10919,6 +10928,8 @@ namespace TypedocConverter.Monaco
/// </summary>
class Position
{
public Position(double lineNumber, double column) => throw new System.NotImplementedException();

/// <summary>
/// column (the first character in a line is between column 1 and column 2)
/// </summary>
Expand Down Expand Up @@ -11018,6 +11029,8 @@ namespace TypedocConverter.Monaco
/// </summary>
class Range
{
public Range(double startLineNumber, double startColumn, double endLineNumber, double endColumn) => throw new System.NotImplementedException();

/// <summary>
/// Column on which the range ends in line `endLineNumber`.
/// </summary>
Expand Down Expand Up @@ -11209,6 +11222,8 @@ namespace TypedocConverter.Monaco
/// </summary>
class Selection : Range
{
public Selection(double selectionStartLineNumber, double selectionStartColumn, double positionLineNumber, double positionColumn) => throw new System.NotImplementedException();

/// <summary>
/// Column on which the range ends in line `endLineNumber`.
/// </summary>
Expand Down Expand Up @@ -11463,6 +11478,8 @@ namespace TypedocConverter.Monaco

class Token
{
public Token(double offset, string type, string language) => throw new System.NotImplementedException();

[Newtonsoft.Json.JsonProperty("_tokenBrand", NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public void TokenBrand { get => throw new System.NotImplementedException(); set => throw new System.NotImplementedException(); }

Expand Down
2 changes: 1 addition & 1 deletion TypedocConverter/Definitions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ and DeclarationHierarchy = {
}
and Type = {
Type: string
Id: int option
Id: int
Name: string option
ElementType: Type option
Value: string option
Expand Down
40 changes: 28 additions & 12 deletions TypedocConverter/Entity.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2,63 +2,79 @@

type Entity =
| TypeEntity of
Id: int *
Name: string *
InnerTypes: Entity list
| TypeParameterEntity of
Id: int *
Name: string // TODO: Add contraints support
| ParameterEntity of
Id: int *
Name: string *
Type: Entity
| ConstructorEntity of
Id: int *
Name: string *
Comment: string *
Modifiers: string list *
Parameters: Entity list
| PropertyEntity of
Id: int *
Name: string *
Comment: string *
Modifier: string list *
Modifiers: string list *
Type: Entity *
WithGet: bool *
WithSet: bool *
IsOptional: bool *
InitialValue: string option
| EventEntity of
Id: int *
Name: string *
Comment: string *
Modifier: string list *
Modifiers: string list *
IsOptional: bool *
Type: Entity
| EnumMemberEntity of
Id: int *
Name: string *
Comment: string *
Value: string option
| MethodEntity of
Id: int *
Name: string *
Comment: string *
Modifier: string list *
TypeParameter: Entity list *
Parameter: Entity list *
TypeParameters: Entity list *
Parameters: Entity list *
ReturnType: Entity
| EnumEntity of
Id: int *
Namespace: string *
Name: string *
Comment: string *
Modifier: string list *
Modifiers: string list *
Members: Entity list
| ClassInterfaceEntity of
Id: int *
Namespace: string *
Name: string *
Comment: string *
Modifier: string list *
Methods: Entity list *
Properties: Entity list *
Events: Entity list *
InheritedFrom: Entity list *
TypeParameter: Entity list *
Modifiers: string list *
Members: Entity list *
InheritedFroms: Entity list *
TypeParameters: Entity list *
IsInterface: bool
| StringUnionEntity of
Id: int *
Namespace: string *
Name: string *
Comment: string *
Modifier: string list *
Modifiers: string list *
Members: Entity list
| TypealiasEntity of // not used
Id: int *
AliasedType: Entity
| UnionTypeEntity of // not used
Id: int *
Types: Entity list
10 changes: 5 additions & 5 deletions TypedocConverter/EnumParser.fs
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ let parseEnum (section: string) (node: Reflection): Entity =
| _ -> ""
let mutable intValue = 0L
match x.DefaultValue with
| Some value -> if Int64.TryParse(value, &intValue) then EnumMemberEntity(x.Name, comment, Some (intValue.ToString()))
| Some value -> if Int64.TryParse(value, &intValue) then EnumMemberEntity(x.Id, x.Name, comment, Some (intValue.ToString()))
else match getEnumReferencedValue values value x.Name with
| Some t -> EnumMemberEntity(x.Name, comment, Some t)
| _ -> EnumMemberEntity(x.Name, comment, None)
| _ -> EnumMemberEntity(x.Name, comment, None)
| Some t -> EnumMemberEntity(x.Id, x.Name, comment, Some t)
| _ -> EnumMemberEntity(x.Id, x.Name, comment, None)
| _ -> EnumMemberEntity(x.Id, x.Name, comment, None)
)
EnumEntity((if section = "" then "TypedocConverter" else section), node.Name,
EnumEntity(node.Id, (if section = "" then "TypedocConverter" else section), node.Name,
(
match node.Comment with
| Some comment -> getXmlDocComment comment
Expand Down
Loading

0 comments on commit acf2960

Please sign in to comment.