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:
@ -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
|
||||
@ -96,21 +93,6 @@ return {
|
||||
opts = {
|
||||
servers = {
|
||||
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",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
Reference in New Issue
Block a user