@jaredly/reason-language-server
v1.0.0-alpha.5
Published
A pure-reason implementation of a language server
Downloads
7
Readme
Reason Language Server
This project implements the Language Server Protocol for reason.
It is written in Reason, and compiled via bsb-native. The goal is for it to work equally well on Windows, MacOS, and Linux.
Usage
VSCode
Install through VS Code extensions. Search for reason-vscode
Visual Studio Code Marketplace: reason-vscode
Can also be installed with VS Code Quick Open: press Cmd/Ctrl + P
, paste the following command, and press enter.
ext install jaredly.reason-vscode
OniVim
Oni has support for reason baked in, and it only needs a little bit of configuration to integrate this langauge server.
- Download the
your-platform.zip
file from the latest release, and unzip it. put thereason-language-server.exe
file somewhere. - Open the oni config file (
cmd+,
), and add the following to theexport const configuration = {
block at the end:
"language.reason.languageServer.command": "/abs/path/to/your/reason-language-server.exe",
"language.reason.languageServer.arguments": [],
"language.reason.languageServer.configuration": {},
And you're done!
Sublime Text
- Install the sublime reason plugin for syntax highlighting, etc. (has to be done manually)
- Install the LSP Plugin via the sublime package manager
- Download the
your-platform.zip
file from the latest release, and unzip it. put thereason-language-server.exe
file somewhere. - cmd+shift+p and type "Preferences: LSP Settings" to bring up the settings file, and put in:
{
"auto_show_diagnostics_panel": false,
"clients": {
"reason": {
"enabled": true,
"command": ["/absolute/path/to/reason-language-server.exe"],
"scopes": ["source.reason"],
"syntaxes": ["Packages/sublime-reason/Reason.tmLanguage"],
"languageId": "reason"
}
}
}
Vim
Install the reason-vim plugin, following the readme. The only change is the LSP configuration should be:
let g:LanguageClient_serverCommands = {
\ 'reason': ['/absolute/path/to/reason-language-server.exe']
\ }
Emacs
TODO people have gotten it to work with emacs, but I don't know the steps.
What about ocaml-language-server?
That project uses merlin under the hood, which is a very powerful and well-developed tool for IDE features in OCaml/Reason. I had a couple of reasons for starting a new one. The biggest is that I wanted something with minimal dependencies, so that windows support would be relatively easy, and so that I might be able to ship it with bucklescript at some future point. (it also makes targetting JS easier). I also wanted a server that was written entirely in Reason (not part typescript, part reason), and something that was written from the ground up with the Langauge Server Protocol in mind, instead of taking a different IDE-support-tool and mapping the LSP onto it.
Contributing
- install
esy
if you don't have it (npm install -g esy@next
) - clone this repo
- cd to the cloned dir
- run
esy
from the main project dir - install the vscode extension's dependencies
cd editor-extensions/vscode && npm i && cd ../..
- open this project in vscode
To test your changes in one of the example projects
- open the "Debug" pane in vscode. Select a debug target. Press "Run"
- it should start up a window titled
[Extension development host]
- you'll have to
npm install && npm run build
in that project directory if you haven't already. - to reload the server if something goes wrong,
cmd+shift+p "restart reason language server"
You can then develop on the language server! When you change something, the server will automatically reload.