mirror of
https://github.com/ViViDboarder/vim-settings.git
synced 2024-12-22 23:37:33 +00:00
Switch from rls to rust-analyzer and from rust.vim to rust-tools.nvim
This includes some transition support for both rls and rust-analyzer that should eventually be removed.
This commit is contained in:
parent
b0e8fe7743
commit
21de929b35
@ -75,7 +75,7 @@ function install_language_servers() {
|
|||||||
|
|
||||||
# Rust
|
# Rust
|
||||||
if want_lang rust ;then
|
if want_lang rust ;then
|
||||||
maybe_run rustup component add rls rustfmt rust-analysis rust-src clippy rustfmt
|
maybe_run rustup component add rustfmt rust-analysis rust-src clippy rust-analyzer
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Go
|
# Go
|
||||||
|
@ -269,6 +269,12 @@ use({
|
|||||||
requires = "neovim/nvim-lspconfig",
|
requires = "neovim/nvim-lspconfig",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- Rust analyzer
|
||||||
|
use({
|
||||||
|
"simrat39/rust-tools.nvim",
|
||||||
|
disable = vim.fn.has("nvim-0.7.0") ~= 1,
|
||||||
|
})
|
||||||
|
|
||||||
-- Better display of lsp diagnostics
|
-- Better display of lsp diagnostics
|
||||||
-- TODO: Pin < 0.7 version
|
-- TODO: Pin < 0.7 version
|
||||||
use({
|
use({
|
||||||
@ -441,7 +447,6 @@ use({
|
|||||||
|
|
||||||
-- Filetypes
|
-- Filetypes
|
||||||
use("ViViDboarder/vim-forcedotcom")
|
use("ViViDboarder/vim-forcedotcom")
|
||||||
use("rust-lang/rust.vim")
|
|
||||||
use("hsanson/vim-android")
|
use("hsanson/vim-android")
|
||||||
use({
|
use({
|
||||||
"sheerun/vim-polyglot",
|
"sheerun/vim-polyglot",
|
||||||
|
@ -254,17 +254,39 @@ function M.config_lsp()
|
|||||||
lsp_config.bashls.setup(default_setup)
|
lsp_config.bashls.setup(default_setup)
|
||||||
lsp_config.gopls.setup(default_setup)
|
lsp_config.gopls.setup(default_setup)
|
||||||
lsp_config.pyright.setup(default_setup)
|
lsp_config.pyright.setup(default_setup)
|
||||||
lsp_config.rls.setup({
|
|
||||||
|
-- Set up rust analyzer (preferred) or rls
|
||||||
|
-- TODO: Remove rls and all configuration for it when all machines are up to date
|
||||||
|
if vim.fn.executable("rust-analyzer") == 1 then
|
||||||
|
-- Prefer rust-tools, if present
|
||||||
|
utils.try_require("rust-tools", function(rust_tools)
|
||||||
|
rust_tools.setup({
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = function(client, bufnr)
|
||||||
|
default_attach(client, bufnr)
|
||||||
|
-- TODO: override some bindings from rust-tools
|
||||||
|
-- Eg. rust_tools.hover_actions.hover_actions or rt.code_action_group.code_action_group
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end, function()
|
||||||
|
lsp_config.rust_analyzer.setup({
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
on_attach = default_attach,
|
on_attach = default_attach,
|
||||||
settings = {
|
settings = {
|
||||||
rust = {
|
["rust-analyzer"] = {
|
||||||
build_on_save = false,
|
cargo = {
|
||||||
all_features = true,
|
features = "all",
|
||||||
unstable_features = true,
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
end)
|
||||||
|
else
|
||||||
|
lsp_config.rls.setup({
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = default_attach,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
-- Configure neovim dev for when sumneko_lua is installed
|
-- Configure neovim dev for when sumneko_lua is installed
|
||||||
utils.try_require("neodev", function(neodev)
|
utils.try_require("neodev", function(neodev)
|
||||||
|
Loading…
Reference in New Issue
Block a user