Skip to content

Commit 23bcade

Browse files
authored
Tools: fix tagged variant module and export more functions (#866)
* tools: fix tagged variant module and export more functions * add attr on resi files * add CHANGELOG.md for tools package
1 parent 091c9fe commit 23bcade

6 files changed

+74
-32
lines changed

tools/CHANGELOG.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Changelog
2+
3+
> **Tags:**
4+
>
5+
> - :boom: [Breaking Change]
6+
> - :eyeglasses: [Spec Compliance]
7+
> - :rocket: [New Feature]
8+
> - :bug: [Bug Fix]
9+
> - :memo: [Documentation]
10+
> - :house: [Internal]
11+
> - :nail_care: [Polish]
12+
13+
## master
14+
15+
#### :rocket: New Feature
16+
17+
- Expose more `decode` functions. https://github.com/rescript-lang/rescript-vscode/pull/866
18+
19+
#### :bug: Bug Fix
20+
21+
- Fix tagged variant for `Module` and add attr to interface files. https://github.com/rescript-lang/rescript-vscode/pull/866

tools/package-lock.json

+9-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tools/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@rescript/tools",
33
"description": "ReScript Tools",
4-
"version": "0.1.3",
4+
"version": "0.2.0",
55
"author": "ReScript Team",
66
"license": "MIT",
77
"bin": {
@@ -36,6 +36,6 @@
3636
"build": "rescript build"
3737
},
3838
"dependencies": {
39-
"rescript": "^11.0.0-rc.4"
39+
"rescript": "^11.0.0-rc.7"
4040
}
4141
}

tools/rescript.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@rescript/tools",
3-
"version": "0.1.0",
3+
"version": "0.2.0",
44
"sources": [
55
{
66
"dir": "src"

tools/src/Tools_Docgen.res

+8-8
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,21 @@ type rec item =
3838
/** Additional documentation for constructors and record fields, if available. */
3939
detail?: detail,
4040
})
41-
| @as("module") Module(docsForModule)
41+
| @as("module")
42+
Module({
43+
id: string,
44+
docstrings: array<string>,
45+
deprecated?: string,
46+
name: string,
47+
items: array<item>,
48+
})
4249
| @as("moduleAlias")
4350
ModuleAlias({
4451
id: string,
4552
docstrings: array<string>,
4653
name: string,
4754
items: array<item>,
4855
})
49-
and docsForModule = {
50-
id: string,
51-
docstrings: array<string>,
52-
deprecated?: string,
53-
name: string,
54-
items: array<item>,
55-
}
5656

5757
let decodeDocstrings = item => {
5858
open Js.Json

tools/src/Tools_Docgen.resi

+33-12
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,52 @@ type constructor = {
1111
signature: string,
1212
deprecated?: string,
1313
}
14-
type detail = Record({items: array<field>}) | Variant({items: array<constructor>})
14+
@tag("kind")
15+
type detail =
16+
| @as("record") Record({items: array<field>})
17+
| @as("variant") Variant({items: array<constructor>})
18+
19+
@tag("kind")
1520
type rec item =
16-
| Value({
21+
| @as("value")
22+
Value({
1723
id: string,
1824
docstrings: array<string>,
1925
signature: string,
2026
name: string,
2127
deprecated?: string,
2228
})
23-
| Type({
29+
| @as("type")
30+
Type({
2431
id: string,
2532
docstrings: array<string>,
2633
signature: string,
2734
name: string,
2835
deprecated?: string,
36+
/** Additional documentation for constructors and record fields, if available. */
2937
detail?: detail,
3038
})
31-
| Module(docsForModule)
32-
| ModuleAlias({id: string, docstrings: array<string>, name: string, items: array<item>})
33-
and docsForModule = {
34-
id: string,
35-
docstrings: array<string>,
36-
deprecated?: string,
37-
name: string,
38-
items: array<item>,
39-
}
39+
| @as("module")
40+
Module({
41+
id: string,
42+
docstrings: array<string>,
43+
deprecated?: string,
44+
name: string,
45+
items: array<item>,
46+
})
47+
| @as("moduleAlias")
48+
ModuleAlias({
49+
id: string,
50+
docstrings: array<string>,
51+
name: string,
52+
items: array<item>,
53+
})
54+
4055
type doc = {name: string, deprecated: option<string>, docstrings: array<string>, items: array<item>}
56+
57+
let decodeValue: Js.Dict.t<Js.Json.t> => item
58+
let decodeType: Js.Dict.t<Js.Json.t> => item
59+
let decodeModule: Js.Dict.t<Js.Json.t> => item
60+
let decodeModuleAlias: Js.Dict.t<Js.Json.t> => item
61+
let decodeItem: Js.Json.t => item
4162
let decodeFromJson: Js.Json.t => doc

0 commit comments

Comments
 (0)