{"id":13484479,"url":"https://github.com/jaredly/reason-language-server","last_synced_at":"2025-04-08T19:22:09.775Z","repository":{"id":45651055,"uuid":"134711318","full_name":"jaredly/reason-language-server","owner":"jaredly","description":"A language server for reason, in reason","archived":false,"fork":false,"pushed_at":"2023-05-14T13:50:16.000Z","size":410032,"stargazers_count":657,"open_issues_count":140,"forks_count":84,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-04-01T17:17:52.760Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"OCaml","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jaredly.png","metadata":{"files":{"readme":"Readme.md","changelog":"Changelog.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-05-24T12:19:48.000Z","updated_at":"2024-11-15T21:17:43.000Z","dependencies_parsed_at":"2024-01-10T18:35:26.204Z","dependency_job_id":null,"html_url":"https://github.com/jaredly/reason-language-server","commit_stats":{"total_commits":859,"total_committers":72,"mean_commits":"11.930555555555555","dds":"0.17462165308498256","last_synced_commit":"ce1b3f8ddb554b6498c2a83ea9c53a6bdf0b6081"},"previous_names":[],"tags_count":42,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredly%2Freason-language-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredly%2Freason-language-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredly%2Freason-language-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredly%2Freason-language-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jaredly","download_url":"https://codeload.github.com/jaredly/reason-language-server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247909244,"owners_count":21016486,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T17:01:25.034Z","updated_at":"2025-04-08T19:22:09.743Z","avatar_url":"https://github.com/jaredly.png","language":"OCaml","funding_links":[],"categories":["OCaml"],"sub_categories":[],"readme":"# NOTICE:\nWith the recent \"rescript\" split, this language server becomes less relevant. If you're working on `.res` files, check out the [rescript-vscode](https://github.com/rescript-lang/rescript-vscode) plugin. If you're using reason/ocaml compiled to native, [ocaml-lsp](https://github.com/ocaml/ocaml-lsp) has the best support for dune.\n\n# Reason Language Server\n\nThis project implements the [Language Server Protocol](https://microsoft.github.io/language-server-protocol/) for Reason.\n\nIt is written in Reason, and compiled w/ esy + dune. The goal is for it to work equally well on Windows, MacOS, and Linux.\n\n## Platform support\n\n- Macos ✅\n- Linux ✅\n- Windows ✅ (but **not under WSL**, make sure you install bs-platform etc. from the windows side)\n\n## Installation\n\n### VS Code\n\nInstall through VS Code extensions. Search for `reason-vscode`:\n\n[Visual Studio Code Marketplace: reason-vscode](https://marketplace.visualstudio.com/items?itemName=jaredly.reason-vscode)\n\nCan also be installed with VS Code Quick Open: press `Cmd/Ctrl + P`, paste the following command, and press enter.\n\n```\next install jaredly.reason-vscode\n```\n\nThe vscode extension is configured via the normal vscode settings screen.\n\n### ArchLinux\n\nThere is a package available in the [AUR](https://aur.archlinux.org/packages/reason-language-server).\n\nUse your favorite AUR helper or:\n\n```\ngit clone https://aur.archlinux.org/reason-language-server.git\ncd reason-language-server\nmakepkg -si\n```\n\n### OniVim\n\nOni has support for Reason baked in, and it only needs a little bit of configuration to integrate this langauge server.\n\n1. Download the `your-platform.zip` file from the [latest release](https://github.com/jaredly/reason-language-server/releases), unzip it, and put the `reason-language-server.exe` file somewhere.\n2. Open the Oni config file (` Ctrl/Cmd + ,`), and add the following to the `export const configuration = {` block at the end:\n```json\n    \"language.reason.languageServer.command\": \"/abs/path/to/your/reason-language-server.exe\",\n    \"language.reason.languageServer.arguments\": [],\n    \"language.reason.languageServer.configuration\": {},\n```\nAnd you're done!\n\n### Sublime Text\n\n1. Install the [sublime reason](https://github.com/reasonml-editor/sublime-reason) plugin for syntax highlighting, etc. (has to be done manually)\n2. Install the [LSP Plugin](https://github.com/tomv564/LSP) via the Sublime Text Package Manager\n3. Download the `your-platform.zip` file from the [latest release](https://github.com/jaredly/reason-language-server/releases), unzip it, and put the `reason-language-server.exe` file somewhere.\n4. `Ctrl/Cmd + Shift + P` and type \"Preferences: LSP Settings\" to bring up the settings file, and put in:\n```json\n{\n  \"clients\": {\n    \"reason\": {\n      \"enabled\": true,\n      \"command\": [\"/absolute/path/to/reason-language-server\"],\n      \"scopes\": [\n        \"source.reason\",\n        \"source.ocaml\"\n      ],\n      \"syntaxes\": [\n        \"Packages/Reason/Reason.tmLanguage\",\n        \"Packages/sublime-reason/Reason.tmLanguage\",\n        \"Packages/OCaml/OCaml.sublime-syntax\"\n      ],\n      \"languageId\": \"reason\"\n    }\n  }\n}\n```\n\nIf you're on a newer version of macOS and receive the error popup \"reason-language-server cannot be opened because the developer cannot be verified\", see [here](https://support.apple.com/guide/mac-help/open-a-mac-app-from-an-unidentified-developer-mh40616/mac).\n\n### Emacs\n\n1. Download the `your-platform.zip` file from the [latest release](https://github.com/jaredly/reason-language-server/releases), unzip it, and put the `reason-language-server.exe` file somewhere.\n2. Assuming you're using [lsp-mode](https://github.com/emacs-lsp/lsp-mode/), add the following to your config file:\n```\n(lsp-register-client\n (make-lsp-client :new-connection (lsp-stdio-connection \"/absolute/path/to/reason-language-server.exe\")\n                  :major-modes '(reason-mode)\n                  :notification-handlers (ht (\"client/registerCapability\" 'ignore))\n                  :priority 1\n                  :server-id 'reason-ls))\n```\n\n### Atom\n\nInstall https://atom.io/packages/ide-reason\n\n### Vim\n\n1. Download the `your-platform.zip` file from the [latest release](https://github.com/jaredly/reason-language-server/releases), unzip it, and put the `reason-language-server.exe` file somewhere.\n2. Install [the vim-reason-plus plugin](https://github.com/reasonml-editor/vim-reason-plus), following the README. Add the following to your `.vimrc` file:\n```vim\nlet g:LanguageClient_serverCommands = {\n    \\ 'reason': ['/absolute/path/to/reason-language-server.exe']\n    \\ }\n```\n\n### Vim config location\n\n[LanguageClient-neovim](https://github.com/autozimu/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:\n\n```json\n{\n  \"reason_language_server\": {\n    \"format_width\": 100\n  }\n}\n```\n\n## Configuration settings\n\nThe language server supports the following settings (not all of them apply to all clients, for example some clients don't support codelenses at all).\n\n- `format_width` - defaults to 80 (int)\n- `per_value_codelens` - show the type of each toplevel value in a lens (bool)\n- `dependencies_codelens` - list a files dependencies at the top (bool)\n- `opens_codelens` - show what values are used from an `open` (bool)\n- `autoRebuild` — rebuild project on save (turned on by default) (bool)\n\n### Debug settings\n\nUseful if you're developing the language server itself.\n\n- `location` - provide a custom binary location for the langauge server (string)\n- `refmt` - provide a custom location for refmt (string)\n- `lispRefmt` - provide a custom location for reason-lisp's refmt (string)\n- `reloadOnChange` - reload the server when the reason-language-server binary is updated (bool). assumes the `location` setting.\n- `show_debug_errors` - pipe the server's stderr into the output pane (bool)\n\n## Troubleshooting\n\nNOTE: 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.\n\nIf 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.\n\nIf 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.\n\nIf you encounter `Unable to find project root dir` error, check that there are no extra `.merlin` files\nin other folders than the project root folder.\n\n## What about the [ocaml-language-server](https://github.com/ocaml-lsp/ocaml-language-server)?\n\nThat project uses [merlin](https://github.com/ocaml/merlin) under the hood, which is a very powerful and well-developed tool for IDE features in OCaml/Reason.\nI 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 Language Server Protocol in mind, instead of taking a different IDE-support-tool and mapping the LSP onto it.\n\n## Contributing\n\n- Install `esy` if you don't have it (`npm install -g esy`)\n- Clone this repo\n- `cd` to the cloned dir\n- Run `esy` from the main project dir\n- Run `esy symlink` to link the built artifact into the root folder at `bin.exe`\n- Install the VS Code extension's dependencies `cd editor-extensions/vscode \u0026\u0026 npm i \u0026\u0026 cd ../..`\n- Open this project in VS Code\n\n### Running the test suite\n\n- `esy cp-test`\n- `./RunTests.exe`\n\nNOTE it's important that you don't run the `RunTests.exe` from within an esy shell (e.g. `esy dune exec RunTests.exe`) -- the variables esy sets will mess things up.\n\n### Building the OCaml grammar\n- Edit the files in editor-extensions/vscode/src/syntaxes\n- Run `cd editor-extensions/vscode \u0026\u0026 npm run build-syntaxes`\n\n### To test your changes in one of the example projects\n- Open the \"Debug\" pane in VS Code. Select a debug target. Press \"Run\"\n- It should start up a window titled `[Extension development host]`\n- Run `npm install \u0026\u0026 npm run build` in the project directory\n- To reload the server if something goes wrong: `Ctrl/Cmd + Shift + P` \"Restart Reason Language Server\"\n\nYou can then develop on the language server! When you change something, the server will automatically reload.\n\n### Building a new release\n\n- Add a commit with the message `actions: release` (it can have anything in the body), that increments the version in `extensions/vscode/package.json` to the desired version. Github actions will see that commit, and build a new github release.\n- then download the .vsix, briefly test it locally, and then use `vsce` to publish the release\n\n## Copyright \u0026 License\n\nCopyright © 2018 Jared Forsyth and contributors.\n\nDistributed under the MIT License (see [LICENSE](./LICENSE)).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaredly%2Freason-language-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaredly%2Freason-language-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaredly%2Freason-language-server/lists"}