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
|
||||
---@return @The full path to the program if found, or nil if not
|
||||
local function get_program_path(program)
|
||||
local fd = io.popen('which ' .. program)
|
||||
local program_path = fd:read('*all')
|
||||
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
|
||||
local home = os.getenv('HOME')
|
||||
local program_path = home .. '/.local/share/nvim/mason/packages/' .. program .. '/' .. program
|
||||
return program_path
|
||||
end
|
||||
|
||||
@ -26,6 +17,13 @@ dap.adapters.lldb = {
|
||||
command = lldb_path,
|
||||
name = 'lldb',
|
||||
}
|
||||
|
||||
dap.adapters.coreclr = {
|
||||
type = 'executable',
|
||||
command = get_program_path('netcoredbg'),
|
||||
args = { '--interpreter=vscode' },
|
||||
}
|
||||
|
||||
-- configurations
|
||||
dap.configurations.cpp = {
|
||||
{
|
||||
@ -56,3 +54,14 @@ dap.configurations.cpp = {
|
||||
|
||||
dap.configurations.c = 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 async = require('plenary.async')
|
||||
|
||||
-- NOTE: Keep this near top
|
||||
lsp_installer.setup({
|
||||
mason_lspconfig.setup({
|
||||
automatic_installation = true,
|
||||
})
|
||||
|
||||
|
@ -234,19 +234,18 @@ return packer.startup({
|
||||
})
|
||||
end,
|
||||
})
|
||||
-- LSP, LSP Installer
|
||||
|
||||
-- Lspconfig
|
||||
use({
|
||||
'neovim/nvim-lspconfig',
|
||||
requires = {
|
||||
'folke/lua-dev.nvim',
|
||||
'Decodetalkers/csharpls-extended-lsp.nvim',
|
||||
'williamboman/mason-lspconfig.nvim',
|
||||
'williamboman/mason.nvim',
|
||||
},
|
||||
})
|
||||
|
||||
use({
|
||||
'williamboman/nvim-lsp-installer',
|
||||
after = 'nvim-lspconfig',
|
||||
config = function()
|
||||
require('mason').setup({})
|
||||
require('plugins.configs.lsp')
|
||||
end,
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user