Add dap to blink
This commit is contained in:
parent
6740f1bdb7
commit
6d7540715a
|
@ -1,204 +1,226 @@
|
|||
return {
|
||||
'saghen/blink.cmp',
|
||||
dependencies = {
|
||||
'rafamadriz/friendly-snippets',
|
||||
'honza/vim-snippets',
|
||||
'neovim/nvim-lspconfig',
|
||||
'williamboman/mason-lspconfig.nvim',
|
||||
},
|
||||
build = 'nix run --extra-experimental-features flakes --extra-experimental-features nix-command .#build-plugin',
|
||||
keys = {
|
||||
{"<leader>n", vim.diagnostic.goto_next},
|
||||
{"<leader>p", vim.diagnostic.goto_prev},
|
||||
{"<leader>f", vim.lsp.buf.code_action},
|
||||
{"gd", vim.lsp.buf.definition},
|
||||
{"gi", vim.lsp.buf.implementation},
|
||||
{"gr", vim.lsp.buf.references},
|
||||
{"<space><space>", vim.lsp.buf.hover},
|
||||
{"<leader>rn", vim.lsp.buf.rename},
|
||||
},
|
||||
opts = {
|
||||
keymap = {
|
||||
['<Tab>'] = { 'select_next', 'snippet_forward', 'fallback' },
|
||||
['<S-Tab>'] = { 'snippet_backward', 'fallback' },
|
||||
['<Up>'] = { 'select_prev', 'fallback' },
|
||||
['<Down>'] = { 'select_next', 'fallback' },
|
||||
['<C-k>'] = { 'select_prev', 'fallback' },
|
||||
['<C-j>'] = { 'select_next', 'fallback' },
|
||||
['<C-S-k>'] = { 'scroll_documentation_up', 'fallback' },
|
||||
['<C-S-j>'] = { 'scroll_documentation_down', 'fallback' },
|
||||
['<C-CR>'] = { 'accept', 'fallback'},
|
||||
},
|
||||
appearance = {
|
||||
nerd_font_variant = 'mono'
|
||||
},
|
||||
sources = {
|
||||
default = { 'lsp', 'path', 'snippets', '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
|
||||
local function is_dap_buffer()
|
||||
return require("cmp_dap").is_dap_buffer()
|
||||
end
|
||||
|
||||
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 = {
|
||||
lsp = {
|
||||
async = true,
|
||||
timeout_ms = 0,
|
||||
}
|
||||
}
|
||||
},
|
||||
completion = {
|
||||
menu = {
|
||||
min_width = 25,
|
||||
draw = {
|
||||
treesitter = { 'lsp' }
|
||||
}
|
||||
},
|
||||
documentation = {
|
||||
auto_show_delay_ms = 0,
|
||||
},
|
||||
list = {
|
||||
selection = { preselect = false, auto_insert = true }
|
||||
}
|
||||
},
|
||||
-- experimental signature help support
|
||||
signature = { enabled = true }
|
||||
return {
|
||||
{
|
||||
'saghen/blink.compat',
|
||||
version = '*',
|
||||
lazy = true,
|
||||
opts = {},
|
||||
},
|
||||
lazy = false,
|
||||
config = function(_, opts)
|
||||
require('blink.cmp').setup(opts)
|
||||
local lspconfig = require('lspconfig')
|
||||
local filetypes = { "bibtex", "gitcommit", "markdown", "org", "tex", "restructuredtext", "rsweave", "latex", "quarto", "rmd", "context", "html", "xhtml", "typst", "mail" }
|
||||
local lsp_opts = {
|
||||
servers = {
|
||||
basedpyright = {
|
||||
settings = {
|
||||
basedpyright = {
|
||||
analysis = {
|
||||
typeCheckingMode = "basic",
|
||||
autoImportCompletions = true
|
||||
{
|
||||
'saghen/blink.cmp',
|
||||
dependencies = {
|
||||
'rafamadriz/friendly-snippets',
|
||||
'honza/vim-snippets',
|
||||
'neovim/nvim-lspconfig',
|
||||
'williamboman/mason-lspconfig.nvim',
|
||||
"rcarriga/cmp-dap",
|
||||
"mfussenegger/nvim-dap"
|
||||
},
|
||||
build = 'nix run --extra-experimental-features flakes --extra-experimental-features nix-command .#build-plugin',
|
||||
keys = {
|
||||
{"<leader>n", vim.diagnostic.goto_next},
|
||||
{"<leader>p", vim.diagnostic.goto_prev},
|
||||
{"<leader>f", vim.lsp.buf.code_action},
|
||||
{"gd", vim.lsp.buf.definition},
|
||||
{"gi", vim.lsp.buf.implementation},
|
||||
{"gr", vim.lsp.buf.references},
|
||||
{"<space><space>", vim.lsp.buf.hover},
|
||||
{"<leader>rn", vim.lsp.buf.rename},
|
||||
},
|
||||
opts = {
|
||||
keymap = {
|
||||
['<Tab>'] = { 'select_next', 'snippet_forward', 'fallback' },
|
||||
['<S-Tab>'] = { 'snippet_backward', 'fallback' },
|
||||
['<Up>'] = { 'select_prev', 'fallback' },
|
||||
['<Down>'] = { 'select_next', 'fallback' },
|
||||
['<C-k>'] = { 'select_prev', 'fallback' },
|
||||
['<C-j>'] = { 'select_next', 'fallback' },
|
||||
['<C-S-k>'] = { 'scroll_documentation_up', 'fallback' },
|
||||
['<C-S-j>'] = { 'scroll_documentation_down', 'fallback' },
|
||||
['<C-CR>'] = { 'accept', 'fallback'},
|
||||
},
|
||||
appearance = {
|
||||
nerd_font_variant = 'mono'
|
||||
},
|
||||
enabled = function()
|
||||
return vim.bo.buftype ~= "prompt" or is_dap_buffer()
|
||||
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 = {
|
||||
dadbod = { name = "Dadbod", module = "vim_dadbod_completion.blink" },
|
||||
dap = { name = "dap", module = "blink.compat.source" },
|
||||
},
|
||||
},
|
||||
completion = {
|
||||
menu = {
|
||||
min_width = 25,
|
||||
draw = {
|
||||
treesitter = { 'lsp' }
|
||||
}
|
||||
},
|
||||
documentation = {
|
||||
auto_show_delay_ms = 0,
|
||||
},
|
||||
list = {
|
||||
selection = { preselect = false, auto_insert = true }
|
||||
}
|
||||
},
|
||||
-- experimental signature help support
|
||||
signature = { enabled = true }
|
||||
},
|
||||
opts_extend = { "sources.default" },
|
||||
lazy = false,
|
||||
config = function(_, opts)
|
||||
require('blink.cmp').setup(opts)
|
||||
local lspconfig = require('lspconfig')
|
||||
local filetypes = { "bibtex", "gitcommit", "markdown", "org", "tex", "restructuredtext", "rsweave", "latex", "quarto", "rmd", "context", "html", "xhtml", "typst", "mail" }
|
||||
local lsp_opts = {
|
||||
servers = {
|
||||
basedpyright = {
|
||||
settings = {
|
||||
basedpyright = {
|
||||
analysis = {
|
||||
typeCheckingMode = "basic",
|
||||
autoImportCompletions = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
emmet_ls = {
|
||||
filetypes = { "css", "eruby", "html", "javascript", "javascriptreact", "less", "sass", "scss", "svelte", "pug", "typescriptreact", "vue" },
|
||||
init_options = {
|
||||
html = {
|
||||
options = {
|
||||
["bem.enabled"] = true,
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
clangd = {
|
||||
cmd = {
|
||||
"clangd",
|
||||
"--background-index",
|
||||
"--clang-tidy",
|
||||
"-j=8",
|
||||
"--clang-tidy-checks=*",
|
||||
"--all-scopes-completion",
|
||||
"--completion-style=bundled",
|
||||
"--cross-file-rename",
|
||||
"--completion-style=detailed",
|
||||
"--header-insertion-decorators",
|
||||
"--header-insertion=iwyu",
|
||||
"--pch-storage=memory"
|
||||
}
|
||||
},
|
||||
tinymist = {
|
||||
offset_encoding = "utf-8",
|
||||
},
|
||||
lua_ls = {
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||
version = 'LuaJIT',
|
||||
},
|
||||
diagnostics = {
|
||||
-- Get the language server to recognize the `vim` global
|
||||
globals = {'vim', 'use', 'awesome', 'client', 'root'},
|
||||
},
|
||||
workspace = {
|
||||
-- Make the server aware of Neovim runtime files
|
||||
library = {
|
||||
['/usr/share/nvim/runtime/lua'] = true,
|
||||
['/usr/share/nvim/runtime/lua/lsp'] = true,
|
||||
['/usr/share/awesome/lib'] = true
|
||||
}
|
||||
},
|
||||
-- Do not send telemetry data containing a randomized but unique identifier
|
||||
telemetry = {
|
||||
enable = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
ltex = {
|
||||
on_attach = function(_, _)
|
||||
require("ltex_extra").setup{
|
||||
load_langs = {"nl-BE", "en-US", "en-GB"},
|
||||
init_check = true,
|
||||
emmet_ls = {
|
||||
filetypes = { "css", "eruby", "html", "javascript", "javascriptreact", "less", "sass", "scss", "svelte", "pug", "typescriptreact", "vue" },
|
||||
init_options = {
|
||||
html = {
|
||||
options = {
|
||||
["bem.enabled"] = true,
|
||||
},
|
||||
},
|
||||
}
|
||||
end,
|
||||
settings = {
|
||||
ltex = {
|
||||
enabled = filetypes,
|
||||
language = "en-GB"
|
||||
},
|
||||
clangd = {
|
||||
cmd = {
|
||||
"clangd",
|
||||
"--background-index",
|
||||
"--clang-tidy",
|
||||
"-j=8",
|
||||
"--clang-tidy-checks=*",
|
||||
"--all-scopes-completion",
|
||||
"--completion-style=bundled",
|
||||
"--cross-file-rename",
|
||||
"--completion-style=detailed",
|
||||
"--header-insertion-decorators",
|
||||
"--header-insertion=iwyu",
|
||||
"--pch-storage=memory"
|
||||
}
|
||||
},
|
||||
tinymist = {
|
||||
offset_encoding = "utf-8",
|
||||
},
|
||||
lua_ls = {
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||
version = 'LuaJIT',
|
||||
},
|
||||
diagnostics = {
|
||||
-- Get the language server to recognize the `vim` global
|
||||
globals = {'vim', 'use', 'awesome', 'client', 'root'},
|
||||
},
|
||||
workspace = {
|
||||
-- Make the server aware of Neovim runtime files
|
||||
library = {
|
||||
['/usr/share/nvim/runtime/lua'] = true,
|
||||
['/usr/share/nvim/runtime/lua/lsp'] = true,
|
||||
['/usr/share/awesome/lib'] = true
|
||||
}
|
||||
},
|
||||
-- Do not send telemetry data containing a randomized but unique identifier
|
||||
telemetry = {
|
||||
enable = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
filetypes = filetypes
|
||||
},
|
||||
bashls = {
|
||||
filetypes = {"sh", "bash", "zsh"},
|
||||
},
|
||||
texlab = {},
|
||||
nixd = {},
|
||||
csharp_ls = {},
|
||||
cmake = {},
|
||||
jsonls = {},
|
||||
kotlin_language_server = {},
|
||||
dockerls = {},
|
||||
vimls = {},
|
||||
html = {},
|
||||
yamlls = {},
|
||||
cssls = {},
|
||||
jdtls = {},
|
||||
rust_analyzer = {},
|
||||
gopls = {},
|
||||
ruff = {},
|
||||
ts_ls= {},
|
||||
ltex = {
|
||||
on_attach = function(_, _)
|
||||
require("ltex_extra").setup{
|
||||
load_langs = {"nl-BE", "en-US", "en-GB"},
|
||||
init_check = true,
|
||||
}
|
||||
end,
|
||||
settings = {
|
||||
ltex = {
|
||||
enabled = filetypes,
|
||||
language = "en-GB"
|
||||
},
|
||||
},
|
||||
filetypes = filetypes
|
||||
},
|
||||
bashls = {
|
||||
filetypes = {"sh", "bash", "zsh"},
|
||||
},
|
||||
texlab = {},
|
||||
nixd = {},
|
||||
csharp_ls = {},
|
||||
cmake = {},
|
||||
jsonls = {},
|
||||
kotlin_language_server = {},
|
||||
dockerls = {},
|
||||
vimls = {},
|
||||
html = {},
|
||||
yamlls = {},
|
||||
cssls = {},
|
||||
jdtls = {},
|
||||
rust_analyzer = {},
|
||||
gopls = {},
|
||||
ruff = {},
|
||||
ts_ls= {},
|
||||
}
|
||||
}
|
||||
}
|
||||
for server, config in pairs(lsp_opts.servers) do
|
||||
config.capabilities = require('blink.cmp').get_lsp_capabilities(config.capabilities)
|
||||
lspconfig[server].setup(config)
|
||||
for server, config in pairs(lsp_opts.servers) do
|
||||
config.capabilities = require('blink.cmp').get_lsp_capabilities(config.capabilities)
|
||||
lspconfig[server].setup(config)
|
||||
end
|
||||
vim.diagnostic.config({
|
||||
virtual_text = false
|
||||
})
|
||||
vim.cmd("autocmd CursorHold,CursorHoldI * lua vim.diagnostic.open_float(nil, {focus=false})")
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
callback = function(args)
|
||||
vim.bo[args.buf].formatexpr = nil
|
||||
end,
|
||||
})
|
||||
end
|
||||
vim.diagnostic.config({
|
||||
virtual_text = false
|
||||
})
|
||||
vim.cmd("autocmd CursorHold,CursorHoldI * lua vim.diagnostic.open_float(nil, {focus=false})")
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
callback = function(args)
|
||||
vim.bo[args.buf].formatexpr = nil
|
||||
end,
|
||||
})
|
||||
end
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue