diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b13cdac66..21824c676 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -192,7 +192,9 @@ Analysis bin is what we currently call the OCaml code that does deeper language We're happy to gather more resources over time here, including more in-depth getting started guides. -## Release +## Releasing the VSCode extension and standalone LSP package + +_This below will automatically release the LSP package as well._ 1. Bump the version to an _even minor_ version number in `package.json` and `server/package.json` and their lockfiles. It's very important that it's an even minor like `1.8.0`, and not `1.7.0`. This is because even minors are reserved for actual releases, and uneven minors for pre-releases. Commit and push the version bump. 2. Make sure @ryyppy is aware of your changes. He needs to sync them over to the vim plugin. @@ -208,4 +210,8 @@ If that somehow does not work, you can do the above steps manually: 2. Go to the appropriate [VSCode Marketplace Publisher](https://marketplace.visualstudio.com/manage/publishers/chenglou92), select the three dots next to the extension name, and choose `Update`. Upload your `.vsix` there. 3. Not done! Make a new manual release [here](https://github.com/rescript-lang/rescript-vscode/releases), and make sure you attach the generated `.vsix` onto that new release as well. This is for folks who don't use the VSCode marketplace. -For beta releases, ask folks to try the `.vsix` from CI directly. +For beta releases, ask folks to use the pre-release version installable from the VSCode Marketplace. + +## Releasing the `@rescript/tools` package + +The tools package is released by bumping the version in `tools/package.json`, running `npm i` in the `tools/` folder, and then pushing those changes with the commit message `publish tools`. diff --git a/README.md b/README.md index cea4ceec9..0b02131a5 100644 --- a/README.md +++ b/README.md @@ -176,16 +176,6 @@ A screenshot of the result: ![Shows the end result in VSCode, with ReScript related files nested under eachother appropriately.](https://user-images.githubusercontent.com/1457626/168123647-400e2f09-31e3-45a2-b74b-190c7c207446.png) -## ⌨️ Use with Other Editors - -This repo also contains a language server that can power other editors. **However, the language server in this project is a pure implementation detail. We don't guarantee its stability for other editors' consumption** apart from Vim and Sublime Text. - -Still, if you'd like to use this language-server with other editors: - -- Get the release binaries from the Github Releases page. -- Unzip the `.vsix` and get the `server` folder. That's the only folder you need. -- The language server will be at `server/out/server.js`. Call it through node, and optionally pass `--stdio` if your editor doesn't support the default JSONRPC. - ## 📰 Changelog See [CHANGELOG](CHANGELOG.md) diff --git a/client/package.json b/client/package.json index 7a9ce0395..6f5dc88b8 100644 --- a/client/package.json +++ b/client/package.json @@ -4,7 +4,7 @@ "version": "0.0.0", "description": "ReScript's language-client", "keywords": [], - "author": "chenglou", + "author": "ReScript Team", "license": "MIT", "dependencies": { "vscode-languageclient": "8.1.0-next.5" diff --git a/package.json b/package.json index 3b7fdc759..f2c245c94 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "rescript-vscode", "displayName": "ReScript", "description": "ReScript language support (official)", - "author": "chenglou", + "author": "ReScript Team", "license": "MIT", "version": "1.20.0", "repository": { diff --git a/server/README.md b/server/README.md index d144a58f9..99a3f71c3 100644 --- a/server/README.md +++ b/server/README.md @@ -15,7 +15,7 @@ resciptls --stdio ```sh ReScript Language Server -Usage: rescriptls [options] +Usage: rescript-ls [options] Options: diff --git a/server/package-lock.json b/server/package-lock.json index dc3d20848..794ec5bc7 100644 --- a/server/package-lock.json +++ b/server/package-lock.json @@ -15,7 +15,7 @@ "vscode-languageserver-protocol": "^3.17.1" }, "bin": { - "rescriptls": "rescriptls" + "rescript-ls": "out/cli.js" }, "engines": { "node": "*" diff --git a/server/package.json b/server/package.json index fbfb20ccb..cb5b77449 100644 --- a/server/package.json +++ b/server/package.json @@ -2,10 +2,10 @@ "name": "@rescript/lsp", "description": "LSP server for ReScript", "version": "1.20.0", - "author": "chenglou", + "author": "ReScript Team", "license": "MIT", "bin": { - "rescriptls": "./out/cli.js" + "rescript-ls": "./out/cli.js" }, "keywords": [ "ReScript", diff --git a/server/src/cli.ts b/server/src/cli.ts index d67f72a78..86d689ccb 100644 --- a/server/src/cli.ts +++ b/server/src/cli.ts @@ -6,7 +6,7 @@ const args = process.argv.slice(2) const help = `ReScript Language Server -Usage: rescriptls [options] +Usage: rescript-ls [options] Options: diff --git a/tools/README.md b/tools/README.md index 6882908fa..874e189f6 100644 --- a/tools/README.md +++ b/tools/README.md @@ -9,7 +9,7 @@ npm install --save-dev @rescript/tools ## CLI Usage ```sh -restools --help +rescript-tools --help ``` ### Generate documentation @@ -17,19 +17,19 @@ restools --help Print JSON: ```sh -restools doc src/EntryPointLibFile.res +rescript-tools doc src/EntryPointLibFile.res ``` Write JSON: ```sh -restools doc src/EntryPointLibFile.res > doc.json +rescript-tools doc src/EntryPointLibFile.res > doc.json ``` ### Reanalyze ```sh -restools reanalyze --help +rescript-tools reanalyze --help ``` ## Decode JSON diff --git a/tools/package-lock.json b/tools/package-lock.json index 2e319de32..7ffb5eb32 100644 --- a/tools/package-lock.json +++ b/tools/package-lock.json @@ -12,7 +12,7 @@ "rescript": "^11.0.0-rc.4" }, "bin": { - "restools": "src/cli.js" + "rescript-tools": "src/Cli.bs.js" }, "engines": { "node": "*" diff --git a/tools/package.json b/tools/package.json index bd9094c22..af7f513b1 100644 --- a/tools/package.json +++ b/tools/package.json @@ -2,10 +2,10 @@ "name": "@rescript/tools", "description": "ReScript Tools", "version": "0.1.0", - "author": "chenglou", + "author": "ReScript Team", "license": "MIT", "bin": { - "restools": "./src/Cli.bs.js" + "rescript-tools": "./src/Cli.bs.js" }, "keywords": [ "ReScript", @@ -17,6 +17,7 @@ "src/*.res", "src/*.resi", "analysis_binaries/", + "rescript.json", "README.md" ], "engines": { diff --git a/tools/rescript.json b/tools/rescript.json index bca259355..e064756bd 100644 --- a/tools/rescript.json +++ b/tools/rescript.json @@ -3,8 +3,7 @@ "version": "0.1.0", "sources": [ { - "dir": "src", - "public": ["RescriptTools"] + "dir": "src" } ], "suffix": ".bs.js", diff --git a/tools/src/Cli.res b/tools/src/Cli.res index 332fc71d6..d4d72b4dd 100644 --- a/tools/src/Cli.res +++ b/tools/src/Cli.res @@ -43,13 +43,13 @@ let docHelp = `ReScript Tools Output documentation to standard output -Usage: restools doc +Usage: rescript-tools doc -Example: restools doc ./path/to/EntryPointLib.res` +Example: rescript-tools doc ./path/to/EntryPointLib.res` let help = `ReScript Tools -Usage: restools [command] +Usage: rescript-tools [command] Commands: diff --git a/tools/src/Cli.resi b/tools/src/Cli.resi new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/tools/src/Cli.resi @@ -0,0 +1 @@ + diff --git a/tools/src/Tools_Docgen.res b/tools/src/Tools_Docgen.res index 2b9cf316b..25d8696a3 100644 --- a/tools/src/Tools_Docgen.res +++ b/tools/src/Tools_Docgen.res @@ -3,20 +3,20 @@ type field = { docstrings: array, signature: string, optional: bool, - deprecated: option, + deprecated?: string, } type constructor = { name: string, docstrings: array, signature: string, - deprecated: option, + deprecated?: string, } @tag("kind") type detail = - | @as("record") Record(array) - | @as("variant") Variant(array) + | @as("record") Record({items: array}) + | @as("variant") Variant({items: array}) @tag("kind") type rec item = @@ -26,7 +26,7 @@ type rec item = docstrings: array, signature: string, name: string, - deprecated: option, + deprecated?: string, }) | @as("type") Type({ @@ -34,9 +34,9 @@ type rec item = docstrings: array, signature: string, name: string, - deprecated: option, + deprecated?: string, /** Additional documentation for constructors and record fields, if available. */ - detail: option, + detail?: detail, }) | @as("module") Module(docsForModule) | @as("moduleAlias") @@ -49,7 +49,7 @@ type rec item = and docsForModule = { id: string, docstrings: array, - deprecated: option, + deprecated?: string, name: string, items: array, } @@ -86,7 +86,7 @@ let decodeDepreacted = item => { let decodeRecordFields = fields => { open Js.Json - let fields = fields->Js.Array2.map(field => { + let items = fields->Js.Array2.map(field => { switch field { | Object(doc) => { let name = doc->decodeStringByField("name") @@ -98,18 +98,18 @@ let decodeRecordFields = fields => { | _ => assert(false) } - {name, docstrings, signature, optional, deprecated} + {name, docstrings, signature, optional, ?deprecated} } | _ => assert(false) } }) - Record(fields) + Record({items: items}) } let decodeConstructorFields = fields => { open Js.Json - let fields = fields->Js.Array2.map(field => { + let items = fields->Js.Array2.map(field => { switch field { | Object(doc) => { let name = doc->decodeStringByField("name") @@ -117,13 +117,13 @@ let decodeConstructorFields = fields => { let signature = doc->decodeStringByField("signature") let deprecated = doc->decodeDepreacted - {name, docstrings, signature, deprecated} + {name, docstrings, signature, ?deprecated} } | _ => assert(false) } }) - Variant(fields) + Variant({items: items}) } let decodeDetail = detail => { @@ -151,7 +151,7 @@ let rec decodeValue = item => { let name = item->decodeStringByField("name") let deprecated = item->decodeDepreacted let docstrings = item->decodeDocstrings - Value({id, docstrings, signature, name, deprecated}) + Value({id, docstrings, signature, name, ?deprecated}) } and decodeType = item => { let id = item->decodeStringByField("id") @@ -163,7 +163,7 @@ and decodeType = item => { | Some(field) => decodeDetail(field)->Some | None => None } - Type({id, docstrings, signature, name, deprecated, detail}) + Type({id, docstrings, signature, name, ?deprecated, ?detail}) } and decodeModuleAlias = item => { open Js.Json @@ -186,7 +186,7 @@ and decodeModule = item => { | Some(Array(items)) => items->Js.Array2.map(item => decodeItem(item)) | _ => assert(false) } - Module({id, name, docstrings, deprecated, items}) + Module({id, name, docstrings, ?deprecated, items}) } and decodeItem = item => { open Js.Json diff --git a/tools/src/Tools_Docgen.resi b/tools/src/Tools_Docgen.resi index 964b1ab34..cd9a38b86 100644 --- a/tools/src/Tools_Docgen.resi +++ b/tools/src/Tools_Docgen.resi @@ -3,37 +3,37 @@ type field = { docstrings: array, signature: string, optional: bool, - deprecated: option, + deprecated?: string, } type constructor = { name: string, docstrings: array, signature: string, - deprecated: option, + deprecated?: string, } -type detail = Record(array) | Variant(array) +type detail = Record({items: array}) | Variant({items: array}) type rec item = | Value({ id: string, docstrings: array, signature: string, name: string, - deprecated: option, + deprecated?: string, }) | Type({ id: string, docstrings: array, signature: string, name: string, - deprecated: option, - detail: option, + deprecated?: string, + detail?: detail, }) | Module(docsForModule) | ModuleAlias({id: string, docstrings: array, name: string, items: array}) and docsForModule = { id: string, docstrings: array, - deprecated: option, + deprecated?: string, name: string, items: array, } diff --git a/tools/src/Tools_Docgen2.res b/tools/src/Tools_Docgen2.res new file mode 100644 index 000000000..4760e3e9c --- /dev/null +++ b/tools/src/Tools_Docgen2.res @@ -0,0 +1,54 @@ +type recordField = { + name: string, + deprecated?: string, + optional: bool, + docstrings: array, + signature: string, +} + +type constructor = { + name: string, + deprecated?: string, + optional: bool, + docstrings: array, + signature: string, +} + +@tag("kind") +type typeDetail = + | @as("record") Record({items: array}) + | @as("variant") Variant({items: array}) + +@tag("kind") +type rec docItem = + | @as("value") + Value({ + id: string, + name: string, + deprecated?: string, + signature: string, + docstrings: array, + }) + | @as("type") + Type({ + id: string, + name: string, + deprecated?: string, + signature: string, + detail?: typeDetail, + }) + | @as("module") Module({id: string, name: string, items: array}) + | @as("moduleAlias") + ModuleAlias({ + id: string, + name: string, + docstrings: array, + items: array, + }) + +type docsForModule = { + name: string, + deprecated?: string, + docstrings: array, + items: array, +}