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,
-- Extend auto completion
-- LSP for Cargo.toml
{
"hrsh7th/nvim-cmp",
optional = true,
dependencies = {
{
"Saecki/crates.nvim",
event = { "BufRead Cargo.toml" },
opts = {
completion = {
cmp = { enabled = true },
},
"Saecki/crates.nvim",
event = { "BufRead Cargo.toml" },
opts = {
completion = {
crates = {
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
@ -90,30 +87,6 @@ return {
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",
optional = true,