Skip to content

Commit

Permalink
use rust-tools
Browse files Browse the repository at this point in the history
resolve conflicts with nvim-lsp-installer

simrat39/rust-tools.nvim#89
  • Loading branch information
JingunSnack committed Sep 27, 2022
1 parent 7887281 commit ce0af86
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
36 changes: 33 additions & 3 deletions lua/user/lsp/lsp-installer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,37 @@ lsp_installer.on_server_ready(function(server)
opts = vim.tbl_deep_extend("force", pyright_opts, opts)
end

-- This setup() function is exactly the same as lspconfig's setup function.
-- Refer to https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
server:setup(opts)
if server.name == "rust_analyzer" then
local rustopts = {
tools = {
autoSetHints = true,
hover_with_actions = false,
inlay_hints = {
show_parameter_hints = true,
parameter_hints_prefix = "",
other_hints_prefix = "",
},
},
server = vim.tbl_deep_extend("force", server:get_default_options(), opts, {
settings = {
["rust-analyzer"] = {
completion = {
postfix = {
enable = false
}
},
checkOnSave = {
command = "clippy"
},
}
}
}),
}
require("rust-tools").setup(rustopts)
server:attach_buffers()
else
-- This setup() function is exactly the same as lspconfig's setup function.
-- Refer to https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
server:setup(opts)
end
end)
1 change: 1 addition & 0 deletions lua/user/plugins.lua
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ return packer.startup(function(use)
-- LSP
use "neovim/nvim-lspconfig" -- enable LSP
use "williamboman/nvim-lsp-installer" -- simple to use language server installer
use "simrat39/rust-tools.nvim"

-- Telescope (fuzz search)
use "nvim-lua/plenary.nvim"
Expand Down

0 comments on commit ce0af86

Please sign in to comment.