1
0
Fork 0

nvim: lsp and dap

This commit is contained in:
Vladimír Dudr 2023-03-19 15:06:03 +01:00
parent 36d2135705
commit 4821c89832
2 changed files with 66 additions and 17 deletions

View file

@ -1,18 +1,22 @@
local ensure = {
'php-debug-adapter',
'netcoredbg'
}
return {
{ 'mfussenegger/nvim-dap',
init = function ()
local php = require("mason-registry").get_package('php-debug-adapter')
if not php:is_installed() then
php:install()
{
'mfussenegger/nvim-dap',
init = function()
for _, pkg in pairs(ensure) do
local p = require('mason-registry').get_package(pkg)
if not p:is_installed() then
p:install()
end
end
end,
dependencies = {
'rcarriga/nvim-dap-ui',
'williamboman/mason.nvim',
},
keys = {
{ '<F2>', function() require('dap').step_over() end },
@ -29,6 +33,24 @@ return {
end, },
},
opts = {
cs = { -- {{{
adapter = {
type = 'executable',
command = 'netcoredbg',
args = { '--interpreter=vscode' },
},
confs ={
{
type = "cs",
name = "launch - netcoredbg",
request = "launch",
program = function()
return vim.fn.input('Path to dll', vim.fn.getcwd() .. '/bin/Debug/', 'file')
end,
},
}
}, --}}}
php = { -- {{{
adapter = {
type = 'executable',
@ -85,7 +107,8 @@ return {
end
end,
},
{ 'leoluz/nvim-dap-go',
{
'leoluz/nvim-dap-go',
ft = 'go',
config = true,
},

View file

@ -23,11 +23,8 @@ local function navic_attach(client, bufnr)
end
local function on_attach(args) -- {{{
-- require "lsp_signature".on_attach()
-- require'completion'.on_attach()
local bufnr = args.buf
local client = vim.lsp.get_client_by_id(args.data.client_id)
if (client.server_capabilities.documentSymbolProvider) then
@ -45,8 +42,36 @@ local function on_attach(args) -- {{{
end
if client.server_capabilities.signatureHelpProvider then
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, mkOpts('LSP signature help'))
vim.keymap.set('i', '<C-k>', vim.lsp.buf.signature_help, mkOpts('LSP signature help'))
require('lsp-overloads').setup(client, {
-- UI options are mostly the same as those passed to vim.lsp.util.open_floating_preview
ui = {
border = 'none', -- The border to use for the signature popup window. Accepts same border values as |nvim_open_win()|.
height = nil, -- Height of the signature popup window (nil allows dynamic sizing based on content of the help)
width = nil, -- Width of the signature popup window (nil allows dynamic sizing based on content of the help)
wrap = true, -- Wrap long lines
wrap_at = nil, -- Character to wrap at for computing height when wrap enabled
max_width = nil, -- Maximum signature popup width
max_height = nil, -- Maximum signature popup height
-- Events that will close the signature popup window: use {"CursorMoved", "CursorMovedI", "InsertCharPre"} to hide the window when typing
close_events = { 'CursorMoved', 'BufHidden', 'InsertLeave' },
focusable = true, -- Make the popup float focusable
focus = false, -- If focusable is also true, and this is set to true, navigating through overloads will focus into the popup window (probably not what you want)
offset_x = 0, -- Horizontal offset of the floating window relative to the cursor position
offset_y = 0, -- Vertical offset of the floating window relative to the cursor position
floating_window_above_cur_line = false, -- Attempt to float the popup above the cursor position
-- (note, if the height of the float would be greater than the space left above the cursor, it will default
-- to placing the float below the cursor. The max_height option allows for finer tuning of this)
},
keymaps = {
next_signature = '<C-j>',
previous_signature = '<C-k>',
next_parameter = '<C-l>',
previous_parameter = '<C-h>',
},
})
vim.keymap.set('n', '<A-k>', '<Cmd>LspOverloadsSignature<CR>', mkOpts('LSP signature help'))
vim.keymap.set('i', '<A-k>', '<Cmd>LspOverloadsSignature<CR>', mkOpts('LSP signature help'))
end
if client.server_capabilities.codeLensProvider then
@ -152,7 +177,7 @@ local function on_attach(args) -- {{{
end
end -- }}}
local function config()
local function config() -- {{{
require('neodev').setup({})
vim.api.nvim_create_autocmd('LspAttach', {
@ -273,7 +298,7 @@ local function config()
end
mlsp.setup({ ensure_installed = ensure })
end
end -- }}}
return {
{
@ -301,6 +326,7 @@ return {
{ 'Hoffs/omnisharp-extended-lsp.nvim', lazy = true },
{ 'b0o/schemastore.nvim', lazy = true },
{ 'folke/neodev.nvim', lazy = true },
{ 'Issafalcon/lsp-overloads.nvim', lazy = true },
{
'williamboman/mason.nvim',
cmd = 'Mason',