From fbe1bf75657ecf7198f4e064f34c84745368dc42 Mon Sep 17 00:00:00 2001 From: Bobby Bingham Date: Sun, 14 May 2023 12:32:03 -0500 Subject: nvim: lsp support for rust --- nvim/.config/nvim/lua/lsp_config.lua | 28 ++++++++++++++++++++++++++++ nvim/.config/nvim/lua/plugins.lua | 1 + 2 files changed, 29 insertions(+) (limited to 'nvim') diff --git a/nvim/.config/nvim/lua/lsp_config.lua b/nvim/.config/nvim/lua/lsp_config.lua index d5fcf14..792811a 100644 --- a/nvim/.config/nvim/lua/lsp_config.lua +++ b/nvim/.config/nvim/lua/lsp_config.lua @@ -64,6 +64,34 @@ for _, lsp in pairs(servers) do }) end +-- rust +require("rust-tools").setup({ + tools = { + runnables = { + use_telescope = true, + }, + inlay_hints = { + auto = true, + show_parameter_hints = false, + parameter_hints_prefix = "", + other_hints_prefix = "", + }, + }, + + -- options to send to nvim-lspconfig + server = { + on_attach = on_attach, + capabilities = capabilities, + settings = { + ["rust-analyzer"] = { + checkOnSave = { + command = "clippy", + }, + }, + }, + }, +}) + -- overrides for typescript lspconfig.tsserver.setup({ on_attach = function(client, bufnr) diff --git a/nvim/.config/nvim/lua/plugins.lua b/nvim/.config/nvim/lua/plugins.lua index a60c9de..7c4e4d4 100644 --- a/nvim/.config/nvim/lua/plugins.lua +++ b/nvim/.config/nvim/lua/plugins.lua @@ -74,6 +74,7 @@ require('packer').startup(function() 'jose-elias-alvarez/null-ls.nvim', 'jose-elias-alvarez/nvim-lsp-ts-utils', 'hrsh7th/cmp-nvim-lsp', + 'simrat39/rust-tools.nvim', }, config = function() require('lsp_config') end, } -- cgit v1.2.3