Add dap to blink
This commit is contained in:
parent
6740f1bdb7
commit
6d7540715a
|
@ -1,10 +1,23 @@
|
||||||
|
local function is_dap_buffer()
|
||||||
|
return require("cmp_dap").is_dap_buffer()
|
||||||
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
{
|
||||||
|
'saghen/blink.compat',
|
||||||
|
version = '*',
|
||||||
|
lazy = true,
|
||||||
|
opts = {},
|
||||||
|
},
|
||||||
|
{
|
||||||
'saghen/blink.cmp',
|
'saghen/blink.cmp',
|
||||||
dependencies = {
|
dependencies = {
|
||||||
'rafamadriz/friendly-snippets',
|
'rafamadriz/friendly-snippets',
|
||||||
'honza/vim-snippets',
|
'honza/vim-snippets',
|
||||||
'neovim/nvim-lspconfig',
|
'neovim/nvim-lspconfig',
|
||||||
'williamboman/mason-lspconfig.nvim',
|
'williamboman/mason-lspconfig.nvim',
|
||||||
|
"rcarriga/cmp-dap",
|
||||||
|
"mfussenegger/nvim-dap"
|
||||||
},
|
},
|
||||||
build = 'nix run --extra-experimental-features flakes --extra-experimental-features nix-command .#build-plugin',
|
build = 'nix run --extra-experimental-features flakes --extra-experimental-features nix-command .#build-plugin',
|
||||||
keys = {
|
keys = {
|
||||||
|
@ -32,35 +45,42 @@ return {
|
||||||
appearance = {
|
appearance = {
|
||||||
nerd_font_variant = 'mono'
|
nerd_font_variant = 'mono'
|
||||||
},
|
},
|
||||||
sources = {
|
enabled = function()
|
||||||
default = { 'lsp', 'path', 'snippets', 'buffer' },
|
return vim.bo.buftype ~= "prompt" or is_dap_buffer()
|
||||||
transform_items = function(_, items)
|
|
||||||
for _, item in ipairs(items) do
|
|
||||||
local types = require('blink.cmp.types')
|
|
||||||
local map = {}
|
|
||||||
map[types.CompletionItemKind.Text] = -3
|
|
||||||
map[types.CompletionItemKind.Method] = 10
|
|
||||||
map[types.CompletionItemKind.Function] = 9
|
|
||||||
map[types.CompletionItemKind.Field] = 8
|
|
||||||
map[types.CompletionItemKind.Class] = 7
|
|
||||||
map[types.CompletionItemKind.Variable] = 6
|
|
||||||
map[types.CompletionItemKind.Property] = 5
|
|
||||||
|
|
||||||
if map[item.kind] ~= nil then
|
|
||||||
item.score_offset = item.score_offset + map[item.kind]
|
|
||||||
end
|
|
||||||
if item.label:match("^__") then
|
|
||||||
item.score_offset = item.score_offset - 3
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return items
|
|
||||||
end,
|
end,
|
||||||
|
sources = {
|
||||||
|
default = function(_)
|
||||||
|
if is_dap_buffer() then
|
||||||
|
return { "dap", "snippets", "buffer" }
|
||||||
|
else
|
||||||
|
return { "lsp", "path", "snippets", "buffer" }
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
-- transform_items = function(_, items)
|
||||||
|
-- for _, item in ipairs(items) do
|
||||||
|
-- local types = require('blink.cmp.types')
|
||||||
|
-- local map = {}
|
||||||
|
-- map[types.CompletionItemKind.Text] = -3
|
||||||
|
-- map[types.CompletionItemKind.Method] = 10
|
||||||
|
-- map[types.CompletionItemKind.Function] = 9
|
||||||
|
-- map[types.CompletionItemKind.Field] = 8
|
||||||
|
-- map[types.CompletionItemKind.Class] = 7
|
||||||
|
-- map[types.CompletionItemKind.Variable] = 6
|
||||||
|
-- map[types.CompletionItemKind.Property] = 5
|
||||||
|
--
|
||||||
|
-- if map[item.kind] ~= nil then
|
||||||
|
-- item.score_offset = item.score_offset + map[item.kind]
|
||||||
|
-- end
|
||||||
|
-- if item.label:match("^__") then
|
||||||
|
-- item.score_offset = item.score_offset - 3
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
-- return items
|
||||||
|
-- end,
|
||||||
providers = {
|
providers = {
|
||||||
lsp = {
|
dadbod = { name = "Dadbod", module = "vim_dadbod_completion.blink" },
|
||||||
async = true,
|
dap = { name = "dap", module = "blink.compat.source" },
|
||||||
timeout_ms = 0,
|
},
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
completion = {
|
completion = {
|
||||||
menu = {
|
menu = {
|
||||||
|
@ -79,6 +99,7 @@ return {
|
||||||
-- experimental signature help support
|
-- experimental signature help support
|
||||||
signature = { enabled = true }
|
signature = { enabled = true }
|
||||||
},
|
},
|
||||||
|
opts_extend = { "sources.default" },
|
||||||
lazy = false,
|
lazy = false,
|
||||||
config = function(_, opts)
|
config = function(_, opts)
|
||||||
require('blink.cmp').setup(opts)
|
require('blink.cmp').setup(opts)
|
||||||
|
@ -202,3 +223,4 @@ return {
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue