mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 05:23:24 +00:00
More details on how to set up coc
This commit is contained in:
parent
1541b2d689
commit
857f3e546c
1 changed files with 21 additions and 0 deletions
|
@ -92,7 +92,13 @@ to load path and require it in `init.el`
|
||||||
## Vim and NeoVim
|
## Vim and NeoVim
|
||||||
|
|
||||||
* Install coc.nvim by following the instructions at [coc.nvim]
|
* Install coc.nvim by following the instructions at [coc.nvim]
|
||||||
|
- You will need nodejs installed.
|
||||||
|
- You may want to include some of the sample vim configurations [from here][coc-vim-conf]
|
||||||
|
- Note that if you use a plugin manager other than `vim-plug`, you may need to manually
|
||||||
|
checkout the `release` branch wherever your plugin manager cloned it. Otherwise you will
|
||||||
|
get errors about a missing javascript file.
|
||||||
* Add rust analyzer using: [coc.nvim wiki][coc-wiki]
|
* Add rust analyzer using: [coc.nvim wiki][coc-wiki]
|
||||||
|
- Use `:CocConfig` in command mode to edit the config file.
|
||||||
|
|
||||||
```jsonc
|
```jsonc
|
||||||
"languageserver": {
|
"languageserver": {
|
||||||
|
@ -101,11 +107,26 @@ to load path and require it in `init.el`
|
||||||
"filetypes": ["rust"],
|
"filetypes": ["rust"],
|
||||||
"rootPatterns": ["Cargo.toml"]
|
"rootPatterns": ["Cargo.toml"]
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
For those not familiar with js, the whole file should be enclosed in `{` and `}`, with all of your config options in between. So for example, if rust-analyzer was your only language server, you could do the following:
|
||||||
|
|
||||||
|
```jsonc
|
||||||
|
{
|
||||||
|
"languageserver": {
|
||||||
|
"rust": {
|
||||||
|
"command": "ra_lsp_server",
|
||||||
|
"filetypes": ["rust"],
|
||||||
|
"rootPatterns": ["Cargo.toml"]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
[coc.nvim]: https://github.com/neoclide/coc.nvim
|
[coc.nvim]: https://github.com/neoclide/coc.nvim
|
||||||
[coc-wiki]: https://github.com/neoclide/coc.nvim/wiki/Language-servers#rust
|
[coc-wiki]: https://github.com/neoclide/coc.nvim/wiki/Language-servers#rust
|
||||||
|
[coc-vim-conf]: https://github.com/neoclide/coc.nvim/#example-vim-configuration
|
||||||
|
|
||||||
|
|
||||||
## Sublime Text 3
|
## Sublime Text 3
|
||||||
|
|
Loading…
Reference in a new issue