We’re very happy to announce that the first versions of two long sought after packages have just been released - @rescript/language-server
and @rescript/tools
!
The ReScript Language Server as an NPM package
The ReScript Language Server that powers the VSCode extension will now ship as a standalone NPM package @rescript/language-server
. This will make it magnitudes simpler to integrate an up-to-date version of the language server in other editors that also uses language servers.
The language server package will be released together with each stable VSCode editor extension release. You can read more about how to use it here: https://github.com/rescript-lang/rescript-vscode/tree/master/server
Automatic doc extraction and reanalyze
The second package we’re shipping is @rescript/tools
. In the first release, it comes with the following capabilities:
Automatic doc extraction
It’s finally possible to automatically extract everything needed to generate documentation from your ReScript code using a CLI. rescript-tools doc src/SomeEntryRescriptFile.res
will go into the target file and extract a JSON structure containing everything needed to generate documentation driven by your ReScript source code. This includes information about all modules, let bindings, types, as well as ReScript signatures for each, extra information about record fields and variant constructors, and so on. All docstrings are naturally included in the output.
The package also comes with ReScript bindings to the generated JSON structure. Read more about this and how to use it here: https://github.com/rescript-lang/rescript-vscode/tree/master/tools
What we’re currently missing (PRs welcome) is a basic markdown “renderer” we can ship with the CLI, so there’s a way to get ready-made documentation out in markdown files via a single command for the situations where you don’t want to do anything fancy with the docs yourself. So, just a simple “JSON structure → markdown” generator. Please reach out if you’re interested in helping out with this.
reanalyze
Reanalyze, ReScript’s dedicated code analyzer for dead code/exceptions/termination analysis lives inside of the editor extension and is best used from inside of the VSCode editor extension. But, there are cases when you’d want to run reanalyze
outside of the editor - CI, CLI tools, and so on.
The tools package exposes reanalyze
outside of the editor extension again via the tools CLI. Read more about using reanalyze
from the CLI here: https://github.com/rescript-lang/rescript-vscode/tree/master/tools
Final words
Feels great to finally get these out. This is a milestone for us given that it’s something we’ve been working on for a long time. Thanks to everyone who’s helped out with this in whatever capacity. And a special thanks to @aspeddro who’s spent a lot of time getting this over the finish line.
Please try these out and don’t be afraid to give feedback, suggestions etc as you test the tools out in the real world. We want to make these tools as good as we can.