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",
|
"saghen/blink.cmp",
|
||||||
|
opts_extend = { "sources.completion.enabled_providers" },
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"rafamadriz/friendly-snippets",
|
"rafamadriz/friendly-snippets",
|
||||||
-- add blink.compat to dependencies
|
-- add blink.compat to dependencies
|
||||||
{
|
{ "saghen/blink.compat", opts = {} },
|
||||||
"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,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
lazy = false, -- lazy loading handled internally
|
lazy = false, -- lazy loading handled internally
|
||||||
|
|
||||||
-- use a release tag to download pre-built binaries
|
-- 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
|
-- OR build from source, requires nightly: https://rust-lang.github.io/rustup/concepts/channels.html#working-with-nightly-rust
|
||||||
-- build = 'cargo build --release',
|
-- build = 'cargo build --release',
|
||||||
-- If you use nix, you can build from source using latest nightly rust with:
|
-- 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.
|
-- your own keymap. when defining your own, no keybinds will be assigned automatically.
|
||||||
keymap = "default",
|
keymap = "default",
|
||||||
|
|
||||||
|
kind_icons = LazyVim.config.icons.kinds,
|
||||||
|
|
||||||
highlight = {
|
highlight = {
|
||||||
-- sets the fallback highlight groups to nvim-cmp's highlight groups
|
-- sets the fallback highlight groups to nvim-cmp's highlight groups
|
||||||
-- useful for when your theme doesn't support blink.cmp
|
-- 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'
|
-- set to 'mono' for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
|
||||||
-- adjusts spacing to ensure icons are aligned
|
-- adjusts spacing to ensure icons are aligned
|
||||||
nerd_font_variant = "normal",
|
nerd_font_variant = "mono",
|
||||||
windows = {
|
windows = {
|
||||||
documentation = {
|
documentation = {
|
||||||
auto_show = true,
|
auto_show = true,
|
||||||
|
@ -63,21 +57,29 @@ return {
|
||||||
sources = {
|
sources = {
|
||||||
completion = {
|
completion = {
|
||||||
-- remember to enable your providers here
|
-- remember to enable your providers here
|
||||||
enabled_providers = { "lsp", "path", "snippets", "buffer", "lazydev" },
|
enabled_providers = { "lsp", "path", "snippets", "buffer" },
|
||||||
},
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- lazydev
|
||||||
|
{
|
||||||
|
"saghen/blink.cmp",
|
||||||
|
opts = {
|
||||||
|
sources = {
|
||||||
|
completion = {
|
||||||
|
-- add lazydev to your completion providers
|
||||||
|
enabled_providers = { "lazydev" },
|
||||||
|
},
|
||||||
providers = {
|
providers = {
|
||||||
|
lsp = {
|
||||||
|
-- dont show LuaLS require statements when lazydev has items
|
||||||
|
fallback_for = { "lazydev" },
|
||||||
|
},
|
||||||
lazydev = {
|
lazydev = {
|
||||||
name = "lazydev", -- IMPORTANT: use the same name as you would for nvim-cmp
|
name = "LazyDev",
|
||||||
module = "blink.compat.source",
|
module = "lazydev.integrations.blink",
|
||||||
|
|
||||||
-- all blink.cmp source config options work as normal:
|
|
||||||
score_offset = 3,
|
|
||||||
|
|
||||||
opts = {
|
|
||||||
-- options for the completion source
|
|
||||||
-- equivalent to `option` field of nvim-cmp source config
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -184,11 +184,13 @@ return {
|
||||||
|
|
||||||
local servers = opts.servers
|
local servers = opts.servers
|
||||||
local has_cmp, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp")
|
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(
|
local capabilities = vim.tbl_deep_extend(
|
||||||
"force",
|
"force",
|
||||||
{},
|
{},
|
||||||
vim.lsp.protocol.make_client_capabilities(),
|
vim.lsp.protocol.make_client_capabilities(),
|
||||||
has_cmp and cmp_nvim_lsp.default_capabilities() or {},
|
has_cmp and cmp_nvim_lsp.default_capabilities() or {},
|
||||||
|
has_blink and blink.get_lsp_capabilities() or {},
|
||||||
opts.capabilities or {}
|
opts.capabilities or {}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue