feat(nvim): use mason
This commit is contained in:
parent
ad50bdc11f
commit
f169c7201c
@ -5,17 +5,8 @@ local async = require('plenary.async')
|
|||||||
---@param program @The string of a program in the PATH
|
---@param program @The string of a program in the PATH
|
||||||
---@return @The full path to the program if found, or nil if not
|
---@return @The full path to the program if found, or nil if not
|
||||||
local function get_program_path(program)
|
local function get_program_path(program)
|
||||||
local fd = io.popen('which ' .. program)
|
local home = os.getenv('HOME')
|
||||||
local program_path = fd:read('*all')
|
local program_path = home .. '/.local/share/nvim/mason/packages/' .. program .. '/' .. program
|
||||||
fd:close()
|
|
||||||
program_path = program_path.gsub(program_path, '\n', '')
|
|
||||||
|
|
||||||
if program_path == nil or program_path == '' then
|
|
||||||
vim.notify(('Failed to find (%s) in your path'):format(program), 'error', {
|
|
||||||
title = 'DAP',
|
|
||||||
})
|
|
||||||
program_path = nil
|
|
||||||
end
|
|
||||||
return program_path
|
return program_path
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -26,6 +17,13 @@ dap.adapters.lldb = {
|
|||||||
command = lldb_path,
|
command = lldb_path,
|
||||||
name = 'lldb',
|
name = 'lldb',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dap.adapters.coreclr = {
|
||||||
|
type = 'executable',
|
||||||
|
command = get_program_path('netcoredbg'),
|
||||||
|
args = { '--interpreter=vscode' },
|
||||||
|
}
|
||||||
|
|
||||||
-- configurations
|
-- configurations
|
||||||
dap.configurations.cpp = {
|
dap.configurations.cpp = {
|
||||||
{
|
{
|
||||||
@ -56,3 +54,14 @@ dap.configurations.cpp = {
|
|||||||
|
|
||||||
dap.configurations.c = dap.configurations.cpp
|
dap.configurations.c = dap.configurations.cpp
|
||||||
dap.configurations.rust = dap.configurations.cpp
|
dap.configurations.rust = dap.configurations.cpp
|
||||||
|
|
||||||
|
dap.configurations.cs = {
|
||||||
|
{
|
||||||
|
type = 'coreclr',
|
||||||
|
name = 'launch - netcoredbg',
|
||||||
|
request = 'launch',
|
||||||
|
program = function()
|
||||||
|
return vim.fn.input('Path to dll: ', vim.fn.getcwd() .. '/bin/Debug/', 'file')
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
local lsp_installer = require('nvim-lsp-installer')
|
local mason_lspconfig = require('mason-lspconfig')
|
||||||
local lspconfig = require('lspconfig')
|
local lspconfig = require('lspconfig')
|
||||||
local async = require('plenary.async')
|
local async = require('plenary.async')
|
||||||
|
|
||||||
-- NOTE: Keep this near top
|
-- NOTE: Keep this near top
|
||||||
lsp_installer.setup({
|
mason_lspconfig.setup({
|
||||||
automatic_installation = true,
|
automatic_installation = true,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -234,19 +234,18 @@ return packer.startup({
|
|||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
-- LSP, LSP Installer
|
|
||||||
|
-- Lspconfig
|
||||||
use({
|
use({
|
||||||
'neovim/nvim-lspconfig',
|
'neovim/nvim-lspconfig',
|
||||||
requires = {
|
requires = {
|
||||||
'folke/lua-dev.nvim',
|
'folke/lua-dev.nvim',
|
||||||
'Decodetalkers/csharpls-extended-lsp.nvim',
|
'Decodetalkers/csharpls-extended-lsp.nvim',
|
||||||
|
'williamboman/mason-lspconfig.nvim',
|
||||||
|
'williamboman/mason.nvim',
|
||||||
},
|
},
|
||||||
})
|
|
||||||
|
|
||||||
use({
|
|
||||||
'williamboman/nvim-lsp-installer',
|
|
||||||
after = 'nvim-lspconfig',
|
|
||||||
config = function()
|
config = function()
|
||||||
|
require('mason').setup({})
|
||||||
require('plugins.configs.lsp')
|
require('plugins.configs.lsp')
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user