diff --git a/tools/CHANGELOG.md b/tools/CHANGELOG.md new file mode 100644 index 000000000..b132821ea --- /dev/null +++ b/tools/CHANGELOG.md @@ -0,0 +1,21 @@ +# Changelog + +> **Tags:** +> +> - :boom: [Breaking Change] +> - :eyeglasses: [Spec Compliance] +> - :rocket: [New Feature] +> - :bug: [Bug Fix] +> - :memo: [Documentation] +> - :house: [Internal] +> - :nail_care: [Polish] + +## master + +#### :rocket: New Feature + +- Expose more `decode` functions. https://github.com/rescript-lang/rescript-vscode/pull/866 + +#### :bug: Bug Fix + +- Fix tagged variant for `Module` and add attr to interface files. https://github.com/rescript-lang/rescript-vscode/pull/866 diff --git a/tools/package-lock.json b/tools/package-lock.json index 8873c010f..594ec9062 100644 --- a/tools/package-lock.json +++ b/tools/package-lock.json @@ -1,15 +1,15 @@ { "name": "@rescript/tools", - "version": "0.1.3", + "version": "0.2.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@rescript/tools", - "version": "0.1.3", + "version": "0.2.0", "license": "MIT", "dependencies": { - "rescript": "^11.0.0-rc.4" + "rescript": "^11.0.0-rc.7" }, "bin": { "rescript-tools": "src/Cli.bs.js" @@ -19,9 +19,9 @@ } }, "node_modules/rescript": { - "version": "11.0.0-rc.4", - "resolved": "https://registry.npmjs.org/rescript/-/rescript-11.0.0-rc.4.tgz", - "integrity": "sha512-yh82o30J2/B/IwyPZjM+mc82FdyPkXRjXxlsUVEoyc5Z/snlq3Za2PhJhlfacwk+ui5lcOZsH8SndWPiI21vXg==", + "version": "11.0.0-rc.7", + "resolved": "https://registry.npmjs.org/rescript/-/rescript-11.0.0-rc.7.tgz", + "integrity": "sha512-N2ImQVkzF4rzV5PBcQ8htKe4NPnqsS2DhtG9A4iic4eYsNim1Ixt8qyuD40WEYl4AZOuYUaEfJlvLTOV9wHogA==", "hasInstallScript": true, "bin": { "bsc": "bsc", @@ -35,9 +35,9 @@ }, "dependencies": { "rescript": { - "version": "11.0.0-rc.4", - "resolved": "https://registry.npmjs.org/rescript/-/rescript-11.0.0-rc.4.tgz", - "integrity": "sha512-yh82o30J2/B/IwyPZjM+mc82FdyPkXRjXxlsUVEoyc5Z/snlq3Za2PhJhlfacwk+ui5lcOZsH8SndWPiI21vXg==" + "version": "11.0.0-rc.7", + "resolved": "https://registry.npmjs.org/rescript/-/rescript-11.0.0-rc.7.tgz", + "integrity": "sha512-N2ImQVkzF4rzV5PBcQ8htKe4NPnqsS2DhtG9A4iic4eYsNim1Ixt8qyuD40WEYl4AZOuYUaEfJlvLTOV9wHogA==" } } } diff --git a/tools/package.json b/tools/package.json index 4d437345f..dca322b1d 100644 --- a/tools/package.json +++ b/tools/package.json @@ -1,7 +1,7 @@ { "name": "@rescript/tools", "description": "ReScript Tools", - "version": "0.1.3", + "version": "0.2.0", "author": "ReScript Team", "license": "MIT", "bin": { @@ -36,6 +36,6 @@ "build": "rescript build" }, "dependencies": { - "rescript": "^11.0.0-rc.4" + "rescript": "^11.0.0-rc.7" } } diff --git a/tools/rescript.json b/tools/rescript.json index e064756bd..3673429fe 100644 --- a/tools/rescript.json +++ b/tools/rescript.json @@ -1,6 +1,6 @@ { "name": "@rescript/tools", - "version": "0.1.0", + "version": "0.2.0", "sources": [ { "dir": "src" diff --git a/tools/src/Tools_Docgen.res b/tools/src/Tools_Docgen.res index 25d8696a3..a7e008d32 100644 --- a/tools/src/Tools_Docgen.res +++ b/tools/src/Tools_Docgen.res @@ -38,7 +38,14 @@ type rec item = /** Additional documentation for constructors and record fields, if available. */ detail?: detail, }) - | @as("module") Module(docsForModule) + | @as("module") + Module({ + id: string, + docstrings: array, + deprecated?: string, + name: string, + items: array, + }) | @as("moduleAlias") ModuleAlias({ id: string, @@ -46,13 +53,6 @@ type rec item = name: string, items: array, }) -and docsForModule = { - id: string, - docstrings: array, - deprecated?: string, - name: string, - items: array, -} let decodeDocstrings = item => { open Js.Json diff --git a/tools/src/Tools_Docgen.resi b/tools/src/Tools_Docgen.resi index cd9a38b86..513471b59 100644 --- a/tools/src/Tools_Docgen.resi +++ b/tools/src/Tools_Docgen.resi @@ -11,31 +11,52 @@ type constructor = { signature: string, deprecated?: string, } -type detail = Record({items: array}) | Variant({items: array}) +@tag("kind") +type detail = + | @as("record") Record({items: array}) + | @as("variant") Variant({items: array}) + +@tag("kind") type rec item = - | Value({ + | @as("value") + Value({ id: string, docstrings: array, signature: string, name: string, deprecated?: string, }) - | Type({ + | @as("type") + Type({ id: string, docstrings: array, signature: string, name: string, deprecated?: string, + /** Additional documentation for constructors and record fields, if available. */ detail?: detail, }) - | Module(docsForModule) - | ModuleAlias({id: string, docstrings: array, name: string, items: array}) -and docsForModule = { - id: string, - docstrings: array, - deprecated?: string, - name: string, - items: array, -} + | @as("module") + Module({ + id: string, + docstrings: array, + deprecated?: string, + name: string, + items: array, + }) + | @as("moduleAlias") + ModuleAlias({ + id: string, + docstrings: array, + name: string, + items: array, + }) + type doc = {name: string, deprecated: option, docstrings: array, items: array} + +let decodeValue: Js.Dict.t => item +let decodeType: Js.Dict.t => item +let decodeModule: Js.Dict.t => item +let decodeModuleAlias: Js.Dict.t => item +let decodeItem: Js.Json.t => item let decodeFromJson: Js.Json.t => doc