Closed
Description
Currently, it seems to me there is no distinction made between a module
and a module type
in doc extraction (I believe, this is true for the LSP as well?). The extracted docs (json) gives no hint, that it's a module type and not an actual implementation.
Furthermore, any implementing module explicitly annotated with the module type is being ignored in doc extraction:
The following rescript code:
// ModuleType.res
/***
extracted docs don't give a hint, that Example is not an implementation, but a module type
module M is missing in extracted docs
*/
module type Example = {
/***
this is an example module type
*/
/**
main type of this module
*/
type t
/**
function from t to t
*/
let f: t => t
}
module M: Example = {
/***
implementation of Example module type
*/
/**
main type
*/
type t = int
/**
identity function
*/
let f = (x: int) => x
}
produces this json:
{
"name": "ModuleType",
"docstrings": ["extracted docs don't give a hint, that Example is not an implementation, but a module type\n\nmodule M is missing in extracted docs"],
"items": [
{
"id": "ModuleType.Example",
"name": "Example",
"kind": "module",
"docstrings": [],
"items": [
{
"id": "ModuleType.Example.t",
"kind": "type",
"name": "t",
"signature": "type t",
"docstrings": ["main type of this module"]
},
{
"id": "ModuleType.Example.f",
"kind": "value",
"name": "f",
"signature": "let f: (. t) => t",
"docstrings": ["function from t to t"]
}]
}]
}
I'm honestly not sure how I'd expect it to be represented in the extracted json. (kind
currently being one of Value
, Type
, Module
)
- I believe the minimal requirement is to distinguish an actual module implementation from a module type, since I won't be able to actually call the lather one. [addressed in distinguish regular modules from module types #925]
- Any (Sub-) Module (not hidden by a
*.resi
file) should be present in the docs. - There is no autocompletion help by the LSP to help with annotating the module type with a module type being a submodule in the same file. (The LSP helps annotating the module type, when the module type from another file is used.)
- The LSP doesn't distinguish between
module
andmodule type
as well:
Typinglet x = ModuleType.Example.
, LSP offers completion forModuleType.Example.f
. - Which is just defined in the module type. Therefore this will yield a compilation error. [addressed in distinguish regular modules from module types #925]
Metadata
Metadata
Assignees
Labels
No labels