Skip to content

rescript-lang/vim-rescript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vim-rescript

Vim runtime files for ReScript.

If you are experiencing any troubles, open an issue or visit our Forum and ask for guidance.

Features

  • Syntax highlighting for ReSript files
  • Filetype detection for .res, .resi
  • Basic automatic indentation

See :h rescript for the detailed helpfile.

Installation

vim-rescript can be installed either manually or by using your favourite plugin manager.

" vim-plug
Plug 'rescript-lang/vim-rescript'

" Vundle
Plugin 'rescript-lang/vim-rescript'

" NeoBundle
NeoBundle 'rescript-lang/vim-rescript'
-- Lazy.nvim
{ 'rescript-lang/vim-rescript', ft="rescript" }

You can also pin your installation to specific tags (check our releases here):

With Plug:

Plug 'rescript-lang/vim-rescript', {'tag': 'v2.1.0'}

With Lazy.nvim:

{ 'rescript-lang/vim-rescript', tag = "v2.1.0" }

Setup LSP

First you need install the language server for ReScript from npm

Note If you are using mason.nvim you can install the ReScript Language Server using the command MasonInstall rescript-language-server

npm install -g @rescript/language-server

The binary is called rescript-language-server

Neovim LSP builtin

Install the nvim-lspconfig package and setup the LSP

local lspconfig = require('lspconfig')

lspconfig.rescriptls.setup{}

For more details, see server configuration

COC (Vim or Neovim)

(:h rescript-coc)

After the installation, open your coc config (:CocConfig) and add the following configuration:

"languageserver": {
  "rescript": {
    "enable": true,
    "module": "rescript-language-server",
    "args": ["--node-ipc"],
    "filetypes": ["rescript"],
    "rootPatterns": ["rescript.json", "bsconfig.json"]
  }
}

Credits

  • amirales: Started the plugin w/ syntax & indent functionality