rescript-lang / rescript-vscode

Official VSCode plugin for ReScript
MIT License
329 stars 56 forks source link

Tools: Print module structure with signature to module path #1018

Closed aspeddro closed 4 months ago

aspeddro commented 4 months ago

The example added in #925 don't print the module M structure

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
}
./node_modules/.bin/rescript-tools doc src/Demo.res
{
  "name": "Demo",
  "docstrings": [],
  "source": {
    "filepath": "src/Demo.res",
    "line": 1,
    "col": 1
  },
  "items": [
  {
    "id": "Demo.Example",
    "name": "Example",
    "kind": "moduleType",
    "docstrings": [],
    "source": {
      "filepath": "src/Demo.res",
      "line": 1,
      "col": 13
    },
    "items": [
    {
      "id": "Demo.Example.t",
      "kind": "type",
      "name": "t",
      "signature": "type t",
      "docstrings": ["main type of this module"],
      "source": {
        "filepath": "src/Demo.res",
        "line": 9,
        "col": 3
      }
    }, 
    {
      "id": "Demo.Example.f",
      "kind": "value",
      "name": "f",
      "signature": "let f: t => t",
      "docstrings": ["function from t to t"],
      "source": {
        "filepath": "src/Demo.res",
        "line": 11,
        "col": 3
      }
    }]
  }]
}