diff options
| author | Michael Lingelbach <m.j.lbach@gmail.com> | 2021-02-28 11:48:55 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-28 11:48:55 -0800 |
| commit | 1bc7d2844417e7084202ec8a105f60d642cc2d3e (patch) | |
| tree | 2166dd994e90a18e2c11aefd0243cdb2404d3590 /lua/lspconfig/rust_analyzer.lua | |
| parent | Merge pull request #763 from ThatsNoMoon/ra-root_dir-deps (diff) | |
| parent | Better context on what workspace was reloaded (diff) | |
| download | nvim-lspconfig-1bc7d2844417e7084202ec8a105f60d642cc2d3e.tar nvim-lspconfig-1bc7d2844417e7084202ec8a105f60d642cc2d3e.tar.gz nvim-lspconfig-1bc7d2844417e7084202ec8a105f60d642cc2d3e.tar.bz2 nvim-lspconfig-1bc7d2844417e7084202ec8a105f60d642cc2d3e.tar.lz nvim-lspconfig-1bc7d2844417e7084202ec8a105f60d642cc2d3e.tar.xz nvim-lspconfig-1bc7d2844417e7084202ec8a105f60d642cc2d3e.tar.zst nvim-lspconfig-1bc7d2844417e7084202ec8a105f60d642cc2d3e.zip | |
Merge pull request #755 from etrnal70/cargo-reload
Add :CargoReload to reload cargo workspace
Diffstat (limited to 'lua/lspconfig/rust_analyzer.lua')
| -rw-r--r-- | lua/lspconfig/rust_analyzer.lua | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lua/lspconfig/rust_analyzer.lua b/lua/lspconfig/rust_analyzer.lua index 772769c0..8e567b0f 100644 --- a/lua/lspconfig/rust_analyzer.lua +++ b/lua/lspconfig/rust_analyzer.lua @@ -1,5 +1,15 @@ local configs = require 'lspconfig/configs' local util = require 'lspconfig/util' +local lsp = vim.lsp + +local function reload_workspace(bufnr) + bufnr = util.validate_bufnr(bufnr) + lsp.buf_request(bufnr, 'rust-analyzer/reloadWorkspace', nil, + function(err, _, result, _) + if err then error(tostring(err)) end + vim.notify("Cargo workspace reloaded") + end) +end configs.rust_analyzer = { default_config = { @@ -20,6 +30,14 @@ configs.rust_analyzer = { ["rust-analyzer"] = {} }; }; + commands = { + CargoReload = { + function() + reload_workspace(0) + end; + description = "Reload current cargo workspace" + } + }; docs = { package_json = "https://raw.githubusercontent.com/rust-analyzer/rust-analyzer/master/editors/code/package.json"; description = [[ @@ -34,4 +52,6 @@ See [docs](https://github.com/rust-analyzer/rust-analyzer/tree/master/docs/user# }; }; }; + +configs.rust_analyzer.reload_workspace = reload_workspace -- vim:et ts=2 sw=2 |
