roc/crates/lang_srv
2023-12-25 17:05:37 +01:00
..
src Merge branch 'main' of github.com:roc-lang/roc into clippy-1.74 2023-12-25 17:05:37 +01:00
Cargo.toml Fix lockfile 2023-10-25 17:17:49 -05:00
debug_server.sh undo change in debug server 2023-11-28 20:22:42 -05:00
README.md Update roc_ls docs 2023-12-15 16:27:37 +01:00

roc_ls

This is a basic language server for Roc.

Support for the following LSP features are provided:

Semantic highlighting will be added soon. Additional features require changes to the compiler infrastructure that are not yet available.

Note that the language server is a bit naïve:

  • If you make a change in a dependency, you'll also need to make a change in the dependents' files for the changes to be picked up.
  • The language server will only operate on changes on save, auto-saving is recommended.

Installing

The roc_lang_server binary is included with the nightly releases. We recommend using the same version of roc and roc_lang_server.

Building from source

Follow the building from source instructions for roc. Then run:

# do `nix develop` first if you're using nix!
cargo build -p roc_lang_srv --release

This will give you the language server binary at:

target/release/roc_ls

Configuring in your editor

Please follow your editor's language server implementation's documentation to see how custom language servers should be configured.

coc.nvim

Add the following to your coc JSON configuration file:

{
  "languageserver": {
    "roc": {
      "command": "<path to binary folder>/roc_ls",
      "filetypes": ["roc"]
    }
  }
}

If you're using coc.nvim and want to use the configuration above, be sure to also instruct your vim that *.roc files have roc filetype.

Debug

If you want to debug the server, use debug_server.sh instead of the direct binary.