From 4821c89832dbb26f7731171caafeb422ab9a9ee5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Dudr?= Date: Sun, 19 Mar 2023 15:06:03 +0100 Subject: [PATCH] nvim: lsp and dap --- dot_config/nvim/lua/configs/packages/dap.lua | 43 +++++++++++++++----- dot_config/nvim/lua/configs/packages/lsp.lua | 40 ++++++++++++++---- 2 files changed, 66 insertions(+), 17 deletions(-) diff --git a/dot_config/nvim/lua/configs/packages/dap.lua b/dot_config/nvim/lua/configs/packages/dap.lua index e69ac72..c6c1355 100644 --- a/dot_config/nvim/lua/configs/packages/dap.lua +++ b/dot_config/nvim/lua/configs/packages/dap.lua @@ -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 = { { '', 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, }, diff --git a/dot_config/nvim/lua/configs/packages/lsp.lua b/dot_config/nvim/lua/configs/packages/lsp.lua index 81159fd..f194859 100644 --- a/dot_config/nvim/lua/configs/packages/lsp.lua +++ b/dot_config/nvim/lua/configs/packages/lsp.lua @@ -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', '', vim.lsp.buf.signature_help, mkOpts('LSP signature help')) - vim.keymap.set('i', '', 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 = '', + previous_signature = '', + next_parameter = '', + previous_parameter = '', + }, + }) + + vim.keymap.set('n', '', 'LspOverloadsSignature', mkOpts('LSP signature help')) + vim.keymap.set('i', '', 'LspOverloadsSignature', 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',