mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-25 14:01:06 +00:00
feat: enable crates.nvim in-process lsp server
This commit is contained in:
parent
f11890bf99
commit
b285c4e258
1 changed files with 13 additions and 40 deletions
|
|
@ -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,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue