update rust cmp

This commit is contained in:
xfy
2024-09-11 09:17:15 +08:00
parent f6452ea37b
commit e7dfe6dcb7
4 changed files with 11 additions and 26 deletions

View File

@ -1,23 +1,4 @@
return {
{
"hrsh7th/nvim-cmp",
dependencies = {
{
"Saecki/crates.nvim",
event = { "BufRead Cargo.toml" },
opts = {
completion = {
cmp = { enabled = true },
},
},
},
},
---@param opts cmp.ConfigSchema
opts = function(_, opts)
opts.sources = opts.sources or {}
table.insert(opts.sources, { name = "crates" })
end,
},
{
"Saecki/crates.nvim",
event = { "BufRead Cargo.toml" },

View File

@ -31,7 +31,7 @@ return {
"volar",
"vtsls",
"tailwindcss",
"eslint-lsp",
"eslint",
"cssls",
"cssmodules_ls",
"jsonls",

View File

@ -3,7 +3,7 @@ return {
event = "InsertEnter",
dependencies = {
"hrsh7th/cmp-buffer", -- source for text in buffer
"hrsh7th/cmp-path", -- source for file system paths
"hrsh7th/cmp-path", -- source for file system paths
{
"L3MON4D3/LuaSnip",
-- follow latest release.
@ -11,9 +11,9 @@ return {
-- install jsregexp (optional!).
build = "make install_jsregexp",
},
"saadparwaiz1/cmp_luasnip", -- for autocompletion
"saadparwaiz1/cmp_luasnip", -- for autocompletion
"rafamadriz/friendly-snippets", -- useful snippets
"onsails/lspkind.nvim", -- vs-code like pictograms
"onsails/lspkind.nvim", -- vs-code like pictograms
},
config = function()
local cmp = require("cmp")
@ -38,15 +38,16 @@ return {
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(), -- show completion suggestions
["<C-e>"] = cmp.mapping.abort(), -- close completion window
["<C-e>"] = cmp.mapping.abort(), -- close completion window
["<CR>"] = cmp.mapping.confirm({ select = true }),
}),
-- sources for autocompletion
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "luasnip" }, -- snippets
{ name = "buffer" }, -- text within current buffer
{ name = "path" }, -- file system paths
{ name = "buffer" }, -- text within current buffer
{ name = "path" }, -- file system paths
{ name = "crates" } -- rust crates
}),
-- configure lspkind for vs-code like pictograms in completion menu

View File

@ -24,9 +24,12 @@ return {
"styled", -- styled components
-- low level
"rust",
"ron",
"toml",
"go",
"gomod",
"gowork",
"gosum",
"sql",
-- git
"git_config",