A language server for reason, in reason
Clone or download
anmonteiro and jaredly Make finding $OCAMLLIB work with Esy sandbox aliases (#188)
* Make finding $OCAMLLIB work with Esy sandbox aliases

* fix code review suggestions
Latest commit 7f94a90 Nov 13, 2018
Permalink
Failed to load latest commit information.
.circleci Esy 0.3.x support (#170) Nov 6, 2018
.github/ISSUE_TEMPLATE Update issue templates Aug 10, 2018
.vscode Disable formatOnSave for reason (#182) Nov 10, 2018
belt ok maybe this is usable as a lib Sep 25, 2018
belt_ppx expose belt_ppx Sep 25, 2018
belt_src umm working? Sep 7, 2018
bin split the lsp code from the analyze code. major step Sep 30, 2018
codemod-example Add support for OCaml 4.07 (#167) Nov 10, 2018
codemod Add support for OCaml 4.07 (#167) Nov 10, 2018
core Add support for OCaml 4.07 (#167) Nov 10, 2018
editor-extensions/vscode Allow to turn off autoRebuild (#183) Nov 10, 2018
examples Allow to turn off autoRebuild (#183) Nov 10, 2018
ocaml_typing Add support for OCaml 4.07 (#167) Nov 10, 2018
pp printtype back to normal Sep 8, 2018
ppx help text & warnings fix Sep 7, 2018
process_ocaml Add support for OCaml 4.07 (#167) Nov 10, 2018
src Make finding $OCAMLLIB work with Esy sandbox aliases (#188) Nov 13, 2018
type-digger Add support for OCaml 4.07 (#167) Nov 10, 2018
util Make finding $OCAMLLIB work with Esy sandbox aliases (#188) Nov 13, 2018
util_tests skip comments in dune files Oct 3, 2018
vendor fix json unicode parsing Nov 10, 2018
.gitignore Add support for OCaml 4.07 (#167) Nov 10, 2018
.npmignore ignore more Sep 25, 2018
Changelog.md Update Changelog.md Oct 9, 2018
LICENSE Add a license (#179) Nov 9, 2018
Readme.md fix esy version (#181) Nov 10, 2018
ReasonLanguageServer.opam wip Sep 25, 2018
appveyor.yml Update appveyor.yml Nov 10, 2018
dune working! Sep 25, 2018
dune-project esy it up Sep 7, 2018
esy.json Add support for OCaml 4.07 (#167) Nov 10, 2018
esy.lock.json Add support for OCaml 4.07 (#167) Nov 10, 2018
logo.png add a logo Nov 3, 2018
logo.svg add a logo Nov 3, 2018
package.json updates Nov 10, 2018
release.sh 1.0.3 - fix windows, better completion Aug 24, 2018

Readme.md

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.

Platform support

  • Macos
  • Linux
  • Windows (but not under WSL, make sure you install bs-platform etc. from the windows side)

Installation

VS Code

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.

  1. Download the your-platform.zip file from the latest release, unzip it, and put the reason-language-server.exe file somewhere.
  2. Open the Oni config file ( Ctrl/Cmd + ,), and add the following to the export 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

  1. Install the sublime reason plugin for syntax highlighting, etc. (has to be done manually)
  2. Install the LSP Plugin via the Sublime Text Package Manager
  3. Download the your-platform.zip file from the latest release, unzip it, and put the reason-language-server.exe file somewhere.
  4. Ctrl/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/Reason/Reason.tmLanguage"],
      "languageId": "reason"
    }
  }
}

Vim

  1. Download the your-platform.zip file from the latest release, unzip it, and put the reason-language-server.exe file somewhere.
  2. Install the vim-reason-plus plugin, following the README. Add the following to your .vimrc file:
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 the 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)
  • Clone this repo
  • cd to the cloned dir
  • Run esy from the main project dir
  • Install the VS Code extension's dependencies cd editor-extensions/vscode && npm i && cd ../..
  • Open this project in VS Code

To test your changes in one of the example projects

  • Open the "Debug" pane in VS Code. Select a debug target. Press "Run"
  • It should start up a window titled [Extension development host]
  • Run npm install && npm run build in the project directory
  • To reload the server if something goes wrong: Ctrl/Cmd + Shift + P "Restart Reason Language Server"

You can then develop on the language server! When you change something, the server will automatically reload.

Copyright & License

Copyright © 2018 Jared Forsyth and contributors.

Distributed under the MIT License (see LICENSE).