mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-21 16:39:06 +02:00
feat(extras): enable crates.nvim in-process lsp server (#4684)
## Description Rather than manually handling hover and completions through nvim-cmp and nvim-lspconfig, enable the crates.nvim in-process lsp server. This also allows crates.nvim to provide code actions. <!-- Describe the big picture of your changes to communicate to the maintainers why we should accept this pull request. --> ## Related Issue(s) This change also removes the direct dependency on nvim-cmp, which should help with #4680 <!-- If this PR fixes any issues, please link to the issue here. - Fixes #<issue_number> --> ## Screenshots <!-- Add screenshots of the changes if applicable. --> ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>
This commit is contained in:
parent
ad52bf91bc
commit
db8895b518
1 changed files with 13 additions and 31 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
|
||||||
|
@ -96,21 +93,6 @@ return {
|
||||||
opts = {
|
opts = {
|
||||||
servers = {
|
servers = {
|
||||||
rust_analyzer = { enabled = false },
|
rust_analyzer = { enabled = false },
|
||||||
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",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue