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

fix(tools): get docstrings from module file #878

Merged
merged 4 commits into from
Dec 30, 2023

Conversation

aspeddro
Copy link
Contributor

FROM_COMPILER=true ./analysis/rescript-editor-analysis.exe extractDocs ~/Desktop/projects/rescript-compiler/jscomp/others/belt.res | jq '{items}[] | map(select(.id == "Belt.Array")) | .[0] | .docstrings'

Before:

[
  "[`Belt.Array`]()\n\n  **mutable array**: Utilities functions"
]

After:

[
  "Utililites for `Array` functions.\n\n### Note about index syntax\n\nCode like `arr[0]` does *not* compile to JavaScript `arr[0]`. Reason transforms\nthe `[]` index synta
x into a function: `Array.get(arr, 0)`. By default, this\nuses the default standard library's `Array.get` function, which may raise an\nexception if the index isn't found. 
If you `open Belt`, it will use the\n`Belt.Array.get` function which returns options instead of raising exceptions. \n[See this for more information](../belt.mdx#array-acce
ss-runtime-safety)."
]

@aspeddro aspeddro marked this pull request as ready for review December 29, 2023 21:41
@zth
Copy link
Collaborator

zth commented Dec 30, 2023

Should we get both rather than dropping one of them?

@aspeddro
Copy link
Contributor Author

of course, it's an array

@zth zth merged commit 089ee0f into rescript-lang:master Dec 30, 2023
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

Successfully merging this pull request may close these issues.

2 participants