feat: enable crates.nvim in-process lsp server

This commit is contained in:
Stefan Boca 2024-11-01 10:47:20 -07:00
parent f11890bf99
commit b285c4e258
No known key found for this signature in database

View file

@ -6,26 +6,23 @@ return {
}) })
end, end,
-- Extend auto completion -- LSP for Cargo.toml
{ {
"hrsh7th/nvim-cmp", "Saecki/crates.nvim",
optional = true, event = { "BufRead Cargo.toml" },
dependencies = { opts = {
{ completion = {
"Saecki/crates.nvim", crates = {
event = { "BufRead Cargo.toml" }, enabled = true,
opts = {
completion = {
cmp = { enabled = true },
},
}, },
}, },
lsp = {
enabled = true,
actions = true,
completion = true,
hover = true,
},
}, },
---@param opts cmp.ConfigSchema
opts = function(_, opts)
opts.sources = opts.sources or {}
table.insert(opts.sources, { name = "crates" })
end,
}, },
-- Add Rust & related to treesitter -- Add Rust & related to treesitter
@ -90,30 +87,6 @@ return {
end, end,
}, },
-- Correctly setup lspconfig for Rust 🚀
{
"neovim/nvim-lspconfig",
opts = {
servers = {
taplo = {
keys = {
{
"K",
function()
if vim.fn.expand("%:t") == "Cargo.toml" and require("crates").popup_available() then
require("crates").show_popup()
else
vim.lsp.buf.hover()
end
end,
desc = "Show Crate Documentation",
},
},
},
},
},
},
{ {
"nvim-neotest/neotest", "nvim-neotest/neotest",
optional = true, optional = true,