npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

reason-language-server

v1.0.0

Published

A pure-reason implementation of a language server

Downloads

4

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.

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

The vscode extension is configured via the normal vscode settings screen.

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"
    }
  }
}

Emacs

  1. Download the your-platform.zip file from the latest release, unzip it, and put the reason-language-server.exe file somewhere.
  2. Assuming you're using lsp-mode, add the following to your config file:
(lsp-register-client
   (make-lsp-client :new-connection (lsp-stdio-connection "/path/to/reason-language-server.exe")
                    :major-modes '(reason-mode)
                    :server-id 'ocaml-ls))

Atom

Install https://atom.io/packages/ide-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']
    \ }

Vim config location

LanguageClient-neovim supports configuring language servers via a configuration file. By default the configuration file is .vim/settings.json in the root of your project. For example to set the format width the file will contain:

{
  "reason_language_server": {
    "format_width": 100
  }
}

Configuration settings

The language server supports the following settings (not all of them apply to all clients, for example some clients don't support codelenses at all).

  • format_width - defaults to 80 (int)
  • per_value_codelens - show the type of each toplevel value in a lens (bool)
  • dependencies_codelens - list a files dependencies at the top (bool)
  • opens_codelens - show what values are used from an open (bool)
  • autoRebuild — rebuild project on save (turned on by default) (bool)

Debug settings

Useful if you're developing the language server itself.

  • location - provide a custom binary location for the langauge server (string)
  • refmt - provide a custom location for refmt (string)
  • lispRefmt - provide a custom location for reason-lisp's refmt (string)
  • reloadOnChange - reload the server when the reason-language-server binary is updated (bool). assumes the location setting.
  • show_debug_errors - pipe the server's stderr into the output pane (bool)

Troubleshooting

NOTE: reason-language-server runs bsb or dune automatically for you, it is not necessary to have a separate process running bsb -w. In fact, having a separate process running can sometimes get the editor into a weird state.

If your editor is in a weird state, the first recourse (if you're in VSCode) is to restart the reason-language-server, with cmd+shift+p "restart reason language server". That often clears things up.

If that doesn't work, try cleaning built artifacts, with bsb -clean-world (or for dune, dune clean). Then try to build, with bsb -make-world (or dune build @install) and see if that works.

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).