aboutsummaryrefslogtreecommitdiffstats
path: root/lua/lspconfig/rust_analyzer.lua
diff options
context:
space:
mode:
authorMichael Lingelbach <m.j.lbach@gmail.com>2020-12-22 18:33:13 -0800
committerMichael Lingelbach <m.j.lbach@gmail.com>2020-12-31 20:57:20 -0800
commitd263e145f432b6c56320ad90a80e2bd8fd7d6ca9 (patch)
tree38238eeaa76dcf856911ecd8e105c06f9a17c2d2 /lua/lspconfig/rust_analyzer.lua
parent[docgen] Update README.md (diff)
downloadnvim-lspconfig-d263e145f432b6c56320ad90a80e2bd8fd7d6ca9.tar
nvim-lspconfig-d263e145f432b6c56320ad90a80e2bd8fd7d6ca9.tar.gz
nvim-lspconfig-d263e145f432b6c56320ad90a80e2bd8fd7d6ca9.tar.bz2
nvim-lspconfig-d263e145f432b6c56320ad90a80e2bd8fd7d6ca9.tar.lz
nvim-lspconfig-d263e145f432b6c56320ad90a80e2bd8fd7d6ca9.tar.xz
nvim-lspconfig-d263e145f432b6c56320ad90a80e2bd8fd7d6ca9.tar.zst
nvim-lspconfig-d263e145f432b6c56320ad90a80e2bd8fd7d6ca9.zip
Rust-analyzer: fix for missing required capabilities
* set normalizesLineEndings and changeAnnotationSupport.groupsOnLabel = true to work around rust-analyzer incompatibilities
Diffstat (limited to 'lua/lspconfig/rust_analyzer.lua')
-rw-r--r--lua/lspconfig/rust_analyzer.lua14
1 files changed, 13 insertions, 1 deletions
diff --git a/lua/lspconfig/rust_analyzer.lua b/lua/lspconfig/rust_analyzer.lua
index 2d545517..12bcfbae 100644
--- a/lua/lspconfig/rust_analyzer.lua
+++ b/lua/lspconfig/rust_analyzer.lua
@@ -1,6 +1,17 @@
local configs = require 'lspconfig/configs'
local util = require 'lspconfig/util'
+-- neovim doesn't support the full 3.16 spec, but latest rust-analyzer requires the following capabilities.
+-- Remove once implemented.
+local default_capabilities = vim.lsp.protocol.make_client_capabilities()
+default_capabilities.workspace.workspaceEdit = {
+ normalizesLineEndings = true;
+ changeAnnotationSupport = {
+ groupsOnLabel = true;
+ };
+};
+default_capabilities.textDocument.rename.prepareSupportDefaultBehavior = 1;
+
configs.rust_analyzer = {
default_config = {
cmd = {"rust-analyzer"};
@@ -8,7 +19,8 @@ configs.rust_analyzer = {
root_dir = util.root_pattern("Cargo.toml", "rust-project.json");
settings = {
["rust-analyzer"] = {}
- }
+ };
+ capabilities = default_capabilities;
};
docs = {
package_json = "https://raw.githubusercontent.com/rust-analyzer/rust-analyzer/master/editors/code/package.json";