Add dap to blink
This commit is contained in:
parent
6740f1bdb7
commit
6d7540715a
|
@ -1,204 +1,226 @@
|
||||||
return {
|
local function is_dap_buffer()
|
||||||
'saghen/blink.cmp',
|
return require("cmp_dap").is_dap_buffer()
|
||||||
dependencies = {
|
end
|
||||||
'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
|
|
||||||
|
|
||||||
if map[item.kind] ~= nil then
|
return {
|
||||||
item.score_offset = item.score_offset + map[item.kind]
|
{
|
||||||
end
|
'saghen/blink.compat',
|
||||||
if item.label:match("^__") then
|
version = '*',
|
||||||
item.score_offset = item.score_offset - 3
|
lazy = true,
|
||||||
end
|
opts = {},
|
||||||
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 }
|
|
||||||
},
|
},
|
||||||
lazy = false,
|
{
|
||||||
config = function(_, opts)
|
'saghen/blink.cmp',
|
||||||
require('blink.cmp').setup(opts)
|
dependencies = {
|
||||||
local lspconfig = require('lspconfig')
|
'rafamadriz/friendly-snippets',
|
||||||
local filetypes = { "bibtex", "gitcommit", "markdown", "org", "tex", "restructuredtext", "rsweave", "latex", "quarto", "rmd", "context", "html", "xhtml", "typst", "mail" }
|
'honza/vim-snippets',
|
||||||
local lsp_opts = {
|
'neovim/nvim-lspconfig',
|
||||||
servers = {
|
'williamboman/mason-lspconfig.nvim',
|
||||||
basedpyright = {
|
"rcarriga/cmp-dap",
|
||||||
settings = {
|
"mfussenegger/nvim-dap"
|
||||||
basedpyright = {
|
},
|
||||||
analysis = {
|
build = 'nix run --extra-experimental-features flakes --extra-experimental-features nix-command .#build-plugin',
|
||||||
typeCheckingMode = "basic",
|
keys = {
|
||||||
autoImportCompletions = true
|
{"<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,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
emmet_ls = {
|
||||||
ltex = {
|
filetypes = { "css", "eruby", "html", "javascript", "javascriptreact", "less", "sass", "scss", "svelte", "pug", "typescriptreact", "vue" },
|
||||||
on_attach = function(_, _)
|
init_options = {
|
||||||
require("ltex_extra").setup{
|
html = {
|
||||||
load_langs = {"nl-BE", "en-US", "en-GB"},
|
options = {
|
||||||
init_check = true,
|
["bem.enabled"] = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
end,
|
},
|
||||||
settings = {
|
clangd = {
|
||||||
ltex = {
|
cmd = {
|
||||||
enabled = filetypes,
|
"clangd",
|
||||||
language = "en-GB"
|
"--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
|
ltex = {
|
||||||
},
|
on_attach = function(_, _)
|
||||||
bashls = {
|
require("ltex_extra").setup{
|
||||||
filetypes = {"sh", "bash", "zsh"},
|
load_langs = {"nl-BE", "en-US", "en-GB"},
|
||||||
},
|
init_check = true,
|
||||||
texlab = {},
|
}
|
||||||
nixd = {},
|
end,
|
||||||
csharp_ls = {},
|
settings = {
|
||||||
cmake = {},
|
ltex = {
|
||||||
jsonls = {},
|
enabled = filetypes,
|
||||||
kotlin_language_server = {},
|
language = "en-GB"
|
||||||
dockerls = {},
|
},
|
||||||
vimls = {},
|
},
|
||||||
html = {},
|
filetypes = filetypes
|
||||||
yamlls = {},
|
},
|
||||||
cssls = {},
|
bashls = {
|
||||||
jdtls = {},
|
filetypes = {"sh", "bash", "zsh"},
|
||||||
rust_analyzer = {},
|
},
|
||||||
gopls = {},
|
texlab = {},
|
||||||
ruff = {},
|
nixd = {},
|
||||||
ts_ls= {},
|
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
|
||||||
for server, config in pairs(lsp_opts.servers) do
|
config.capabilities = require('blink.cmp').get_lsp_capabilities(config.capabilities)
|
||||||
config.capabilities = require('blink.cmp').get_lsp_capabilities(config.capabilities)
|
lspconfig[server].setup(config)
|
||||||
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
|
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