mirror of
https://github.com/roc-lang/roc.git
synced 2024-11-10 10:02:38 +03:00
Add readme
This commit is contained in:
parent
03d132cf6d
commit
fbd84d2c2c
66
crates/lang_srv/README.md
Normal file
66
crates/lang_srv/README.md
Normal file
@ -0,0 +1,66 @@
|
||||
# roc_ls
|
||||
|
||||
This is a rudimentary language server for supporting basic editor usage in Roc.
|
||||
|
||||
Support for the following LSP features are provided:
|
||||
|
||||
- Inline diagnostics
|
||||
- Hover support to get types of values
|
||||
- Go-to-definition
|
||||
!(go-to-definition in roc pg)[./img/go-to-definition.mov]
|
||||
- Note that go-to-definition for the builtins does not yet work.
|
||||
- Go-to-definition for abilities resolves to their specialization, if one exists.
|
||||
!(go-to-definition in roc pg)[./img/go-to-definition-abilities.mov]
|
||||
- Formatting Roc files on save
|
||||
!(format)[./img/format.mov]
|
||||
|
||||
Semantic highlighting will also be added soon. Additional features require
|
||||
changes to the compiler infrastructure that are not yet available.
|
||||
|
||||
Note that the language server is a bit naive:
|
||||
- If you make a change in a dependency, you'll need to also make a change in
|
||||
the dependents' files for the changes to be picked up
|
||||
- The language server will only operate on changes that are also reflected on
|
||||
disk (so save often)
|
||||
|
||||
## Installing
|
||||
|
||||
At this time, only from-source installations of the binary are supported.
|
||||
|
||||
Follow the (installation from source)[https://github.com/roc-lang/roc/tree/main/getting_started#installation] instructions. Then run
|
||||
|
||||
```
|
||||
cargo build -p roc_lang_srv --release
|
||||
```
|
||||
|
||||
which will give you a 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](https://github.com/neoclide/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](./debug_server.sh)
|
||||
instead of the direct binary.
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
SCRIPT_DIR=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)
|
||||
${SCRIPT_DIR}/../../target/debug/roc_ls "$@" 2> /tmp/rocls.err
|
||||
${SCRIPT_DIR}/../../target/debug/roc_ls "$@" 2> /tmp/roc_ls.err
|
||||
|
BIN
crates/lang_srv/img/format.mov
Normal file
BIN
crates/lang_srv/img/format.mov
Normal file
Binary file not shown.
BIN
crates/lang_srv/img/go-to-definition-abilities.mov
Normal file
BIN
crates/lang_srv/img/go-to-definition-abilities.mov
Normal file
Binary file not shown.
BIN
crates/lang_srv/img/go-to-definition.mov
Normal file
BIN
crates/lang_srv/img/go-to-definition.mov
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user