mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-22 08:53:33 +02:00
feat: use lazydev blink source
This commit is contained in:
parent
55f1bc79b1
commit
488ae9efb9
2 changed files with 27 additions and 23 deletions
|
@ -5,24 +5,16 @@ return {
|
|||
},
|
||||
{
|
||||
"saghen/blink.cmp",
|
||||
opts_extend = { "sources.completion.enabled_providers" },
|
||||
dependencies = {
|
||||
"rafamadriz/friendly-snippets",
|
||||
-- add blink.compat to dependencies
|
||||
{
|
||||
"saghen/blink.compat",
|
||||
opts = {
|
||||
-- lazydev.nvim only registers the completion source when nvim-cmp is
|
||||
-- loaded, so pretend that we are nvim-cmp, and that nvim-cmp is loaded.
|
||||
-- this option only has effect when using lazy.nvim
|
||||
-- this should not be required in most cases
|
||||
impersontate_nvim_cmp = true,
|
||||
},
|
||||
},
|
||||
{ "saghen/blink.compat", opts = {} },
|
||||
},
|
||||
lazy = false, -- lazy loading handled internally
|
||||
|
||||
-- use a release tag to download pre-built binaries
|
||||
version = "v0.*",
|
||||
version = "*",
|
||||
-- OR build from source, requires nightly: https://rust-lang.github.io/rustup/concepts/channels.html#working-with-nightly-rust
|
||||
-- build = 'cargo build --release',
|
||||
-- If you use nix, you can build from source using latest nightly rust with:
|
||||
|
@ -37,6 +29,8 @@ return {
|
|||
-- your own keymap. when defining your own, no keybinds will be assigned automatically.
|
||||
keymap = "default",
|
||||
|
||||
kind_icons = LazyVim.config.icons.kinds,
|
||||
|
||||
highlight = {
|
||||
-- sets the fallback highlight groups to nvim-cmp's highlight groups
|
||||
-- useful for when your theme doesn't support blink.cmp
|
||||
|
@ -45,7 +39,7 @@ return {
|
|||
},
|
||||
-- set to 'mono' for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
|
||||
-- adjusts spacing to ensure icons are aligned
|
||||
nerd_font_variant = "normal",
|
||||
nerd_font_variant = "mono",
|
||||
windows = {
|
||||
documentation = {
|
||||
auto_show = true,
|
||||
|
@ -63,21 +57,29 @@ return {
|
|||
sources = {
|
||||
completion = {
|
||||
-- remember to enable your providers here
|
||||
enabled_providers = { "lsp", "path", "snippets", "buffer", "lazydev" },
|
||||
enabled_providers = { "lsp", "path", "snippets", "buffer" },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
providers = {
|
||||
lazydev = {
|
||||
name = "lazydev", -- IMPORTANT: use the same name as you would for nvim-cmp
|
||||
module = "blink.compat.source",
|
||||
|
||||
-- all blink.cmp source config options work as normal:
|
||||
score_offset = 3,
|
||||
|
||||
-- lazydev
|
||||
{
|
||||
"saghen/blink.cmp",
|
||||
opts = {
|
||||
-- options for the completion source
|
||||
-- equivalent to `option` field of nvim-cmp source config
|
||||
sources = {
|
||||
completion = {
|
||||
-- add lazydev to your completion providers
|
||||
enabled_providers = { "lazydev" },
|
||||
},
|
||||
providers = {
|
||||
lsp = {
|
||||
-- dont show LuaLS require statements when lazydev has items
|
||||
fallback_for = { "lazydev" },
|
||||
},
|
||||
lazydev = {
|
||||
name = "LazyDev",
|
||||
module = "lazydev.integrations.blink",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
@ -184,11 +184,13 @@ return {
|
|||
|
||||
local servers = opts.servers
|
||||
local has_cmp, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp")
|
||||
local has_blink, blink = pcall(require, "blink.cmp")
|
||||
local capabilities = vim.tbl_deep_extend(
|
||||
"force",
|
||||
{},
|
||||
vim.lsp.protocol.make_client_capabilities(),
|
||||
has_cmp and cmp_nvim_lsp.default_capabilities() or {},
|
||||
has_blink and blink.get_lsp_capabilities() or {},
|
||||
opts.capabilities or {}
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue