nvim: lsp and dap
This commit is contained in:
parent
36d2135705
commit
4821c89832
2 changed files with 66 additions and 17 deletions
|
@ -1,18 +1,22 @@
|
||||||
|
local ensure = {
|
||||||
|
'php-debug-adapter',
|
||||||
|
'netcoredbg'
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
{ 'mfussenegger/nvim-dap',
|
{
|
||||||
init = function ()
|
'mfussenegger/nvim-dap',
|
||||||
local php = require("mason-registry").get_package('php-debug-adapter')
|
init = function()
|
||||||
if not php:is_installed() then
|
for _, pkg in pairs(ensure) do
|
||||||
php:install()
|
local p = require('mason-registry').get_package(pkg)
|
||||||
|
if not p:is_installed() then
|
||||||
|
p:install()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
dependencies = {
|
dependencies = {
|
||||||
'rcarriga/nvim-dap-ui',
|
'rcarriga/nvim-dap-ui',
|
||||||
'williamboman/mason.nvim',
|
'williamboman/mason.nvim',
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
keys = {
|
keys = {
|
||||||
{ '<F2>', function() require('dap').step_over() end },
|
{ '<F2>', function() require('dap').step_over() end },
|
||||||
|
@ -29,6 +33,24 @@ return {
|
||||||
end, },
|
end, },
|
||||||
},
|
},
|
||||||
opts = {
|
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 = { -- {{{
|
php = { -- {{{
|
||||||
adapter = {
|
adapter = {
|
||||||
type = 'executable',
|
type = 'executable',
|
||||||
|
@ -85,7 +107,8 @@ return {
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{ 'leoluz/nvim-dap-go',
|
{
|
||||||
|
'leoluz/nvim-dap-go',
|
||||||
ft = 'go',
|
ft = 'go',
|
||||||
config = true,
|
config = true,
|
||||||
},
|
},
|
||||||
|
|
|
@ -23,11 +23,8 @@ local function navic_attach(client, bufnr)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function on_attach(args) -- {{{
|
local function on_attach(args) -- {{{
|
||||||
-- require "lsp_signature".on_attach()
|
|
||||||
-- require'completion'.on_attach()
|
|
||||||
local bufnr = args.buf
|
local bufnr = args.buf
|
||||||
|
|
||||||
|
|
||||||
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
||||||
|
|
||||||
if (client.server_capabilities.documentSymbolProvider) then
|
if (client.server_capabilities.documentSymbolProvider) then
|
||||||
|
@ -45,8 +42,36 @@ local function on_attach(args) -- {{{
|
||||||
end
|
end
|
||||||
|
|
||||||
if client.server_capabilities.signatureHelpProvider then
|
if client.server_capabilities.signatureHelpProvider then
|
||||||
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, mkOpts('LSP signature help'))
|
require('lsp-overloads').setup(client, {
|
||||||
vim.keymap.set('i', '<C-k>', vim.lsp.buf.signature_help, mkOpts('LSP signature help'))
|
-- 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
|
end
|
||||||
|
|
||||||
if client.server_capabilities.codeLensProvider then
|
if client.server_capabilities.codeLensProvider then
|
||||||
|
@ -152,7 +177,7 @@ local function on_attach(args) -- {{{
|
||||||
end
|
end
|
||||||
end -- }}}
|
end -- }}}
|
||||||
|
|
||||||
local function config()
|
local function config() -- {{{
|
||||||
require('neodev').setup({})
|
require('neodev').setup({})
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd('LspAttach', {
|
vim.api.nvim_create_autocmd('LspAttach', {
|
||||||
|
@ -273,7 +298,7 @@ local function config()
|
||||||
end
|
end
|
||||||
|
|
||||||
mlsp.setup({ ensure_installed = ensure })
|
mlsp.setup({ ensure_installed = ensure })
|
||||||
end
|
end -- }}}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
|
@ -301,6 +326,7 @@ return {
|
||||||
{ 'Hoffs/omnisharp-extended-lsp.nvim', lazy = true },
|
{ 'Hoffs/omnisharp-extended-lsp.nvim', lazy = true },
|
||||||
{ 'b0o/schemastore.nvim', lazy = true },
|
{ 'b0o/schemastore.nvim', lazy = true },
|
||||||
{ 'folke/neodev.nvim', lazy = true },
|
{ 'folke/neodev.nvim', lazy = true },
|
||||||
|
{ 'Issafalcon/lsp-overloads.nvim', lazy = true },
|
||||||
{
|
{
|
||||||
'williamboman/mason.nvim',
|
'williamboman/mason.nvim',
|
||||||
cmd = 'Mason',
|
cmd = 'Mason',
|
||||||
|
|
Loading…
Add table
Reference in a new issue