Skip to content
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

docgen should name module type for explicitly annotated module type #1010

Closed
woeps opened this issue Jun 7, 2024 · 3 comments
Closed

docgen should name module type for explicitly annotated module type #1010

woeps opened this issue Jun 7, 2024 · 3 comments

Comments

@woeps
Copy link
Contributor

woeps commented Jun 7, 2024

Once #1009 is implemented, I think we should include the annotated module type in the generated json:

// Example.res
module type MT = {
  let x: int
}

module M: MT = {
  let x = 42
}

should generate

{
  "name": "Example",
  "docstrings": [],
  "source": {
    "filepath": "src/Example.res",
    "line": 1,
    "col": 1
  },
  "items": [
  {
    "id": "Example.MT",
    "name": "MT",
    "kind": "moduleType",
    "docstrings": [],
    "source": {
      "filepath": "src/Example.res",
      "line": 1,
      "col": 13
    },
    "items": [
    {
      "id": "Example.MT.x",
      "kind": "value",
      "name": "x",
      "signature": "let x: int",
      "docstrings": [],
      "source": {
        "filepath": "src/Example.res",
        "line": 2,
        "col": 3
      }
    }]
  }, 
  {
    "id": "Example.M",
    "name": "M",
    "kind": "module",
    "moduleType": "Example.MT"  <-- this is new!
    "docstrings": [],
    "source": {
      "filepath": "src/Example.res",
      "line": 5,
      "col": 8
    },
    "items": [
    {
      "id": "Example.M.x",
      "kind": "value",
      "name": "x",
      "signature": "let x: int",
      "docstrings": [],
      "source": {
        "filepath": "src/Example.res",
        "line": 6,
        "col": 7
      }
    }]
  }]
}

Note in the above example, a moduleType field got added and id of the annotated module type was used as a value.

@aspeddro
Copy link
Contributor

I was unsure if I should add this.

@aspeddro
Copy link
Contributor

See #1019

@woeps
Copy link
Contributor Author

woeps commented Jun 17, 2024

implemented in #1019

@woeps woeps closed this as completed Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants