-
Notifications
You must be signed in to change notification settings - Fork 60
add moduletypeid
field for modules with explicitly annotated module type
#1019
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
0114650
a67efa5
162899d
14aba6a
4ef0bde
de20676
a40df41
862eff9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,7 +44,14 @@ type docItem = | |
(** Additional documentation for constructors and record fields, if available. *) | ||
} | ||
| Module of docsForModule | ||
| ModuleType of docsForModule | ||
| ModuleType of { | ||
id: string; | ||
docstring: string list; | ||
deprecated: string option; | ||
name: string; | ||
source: source; | ||
items: docItem list; | ||
} | ||
| ModuleAlias of { | ||
id: string; | ||
docstring: string list; | ||
|
@@ -57,6 +64,7 @@ and docsForModule = { | |
docstring: string list; | ||
deprecated: string option; | ||
name: string; | ||
moduletype: string option; | ||
source: source; | ||
items: docItem list; | ||
} | ||
|
@@ -195,6 +203,10 @@ let rec stringifyDocItem ?(indentation = 0) ~originalEnv (item : docItem) = | |
match m.deprecated with | ||
| Some d -> Some (wrapInQuotes d) | ||
| None -> None ); | ||
( "moduletype", | ||
match m.moduletype with | ||
| Some path -> Some (wrapInQuotes path) | ||
| None -> None ); | ||
("docstrings", Some (stringifyDocstrings m.docstring)); | ||
( "source", | ||
Some (stringifySource ~indentation:(indentation + 1) m.source) ); | ||
|
@@ -356,6 +368,7 @@ let extractDocs ~entryPointFile ~debug = | |
id = modulePath |> List.rev |> ident; | ||
docstring = structure.docstring |> List.map String.trim; | ||
name = structure.name; | ||
moduletype = None; | ||
deprecated = structure.deprecated; | ||
source = | ||
{ | ||
|
@@ -439,6 +452,7 @@ let extractDocs ~entryPointFile ~debug = | |
{ | ||
id = modulePath |> List.rev |> ident; | ||
name = m.name; | ||
moduletype = None; | ||
docstring = item.docstring @ m.docstring; | ||
deprecated = item.deprecated; | ||
source; | ||
|
@@ -469,12 +483,13 @@ let extractDocs ~entryPointFile ~debug = | |
(extractDocsForModule | ||
~modulePath:(interface.name :: modulePath) | ||
interface)) | ||
| Module {type_ = Constraint (Structure m, Ident _)} -> | ||
(* module M: T = { }. Print M *) | ||
Some | ||
(Module | ||
(extractDocsForModule | ||
~modulePath:(m.name :: modulePath) m)) | ||
| Module {type_ = Constraint (Structure m, Ident p)} -> | ||
(* module M: T = { <impl> }. Print M *) | ||
let docs = | ||
extractDocsForModule ~modulePath:(m.name :: modulePath) | ||
m | ||
in | ||
Some (Module {docs with moduletype = Some (Path.name p)}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this the same string, which is used for the id of the module type, when generating json for the module type? For further processing it would make sense, to use the id. If so, the record field should probably renamed as well ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Renamed field to a67efa5 added full id |
||
| _ -> None); | ||
} | ||
in | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you update the rescript types accordingly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a67efa5