refactor(nvim): use vim stdpath for mason paths
This commit is contained in:
parent
63bf0fc759
commit
c9ea524fb4
@ -1,41 +1,40 @@
|
|||||||
local dap = require('dap')
|
local dap = require("dap")
|
||||||
local async = require('plenary.async')
|
local async = require("plenary.async")
|
||||||
|
|
||||||
--- Gets a path for a given program in the environment
|
--- Gets a path for a given program in the environment
|
||||||
---@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 home = os.getenv('HOME')
|
local program_path = vim.fn.stdpath("data") .. "/mason/packages/" .. program .. "/" .. program
|
||||||
local program_path = home .. '/.local/share/nvim/mason/packages/' .. program .. '/' .. program
|
|
||||||
return program_path
|
return program_path
|
||||||
end
|
end
|
||||||
|
|
||||||
local lldb_path = get_program_path('lldb-vscode')
|
local lldb_path = get_program_path("lldb-vscode")
|
||||||
-- Adapaters
|
-- Adapaters
|
||||||
dap.adapters.lldb = {
|
dap.adapters.lldb = {
|
||||||
type = 'executable',
|
type = "executable",
|
||||||
command = lldb_path,
|
command = lldb_path,
|
||||||
name = 'lldb',
|
name = "lldb",
|
||||||
}
|
}
|
||||||
|
|
||||||
dap.adapters.coreclr = {
|
dap.adapters.coreclr = {
|
||||||
type = 'executable',
|
type = "executable",
|
||||||
command = get_program_path('netcoredbg'),
|
command = get_program_path("netcoredbg"),
|
||||||
args = { '--interpreter=vscode' },
|
args = { "--interpreter=vscode" },
|
||||||
}
|
}
|
||||||
|
|
||||||
-- configurations
|
-- configurations
|
||||||
dap.configurations.cpp = {
|
dap.configurations.cpp = {
|
||||||
{
|
{
|
||||||
name = 'Launch',
|
name = "Launch",
|
||||||
type = 'lldb',
|
type = "lldb",
|
||||||
request = 'launch',
|
request = "launch",
|
||||||
program = function()
|
program = function()
|
||||||
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
|
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
|
||||||
end,
|
end,
|
||||||
cwd = '${workspaceFolder}',
|
cwd = "${workspaceFolder}",
|
||||||
stopOnEntry = false,
|
stopOnEntry = false,
|
||||||
targetArchitecture = 'arm64',
|
targetArchitecture = "arm64",
|
||||||
args = {},
|
args = {},
|
||||||
|
|
||||||
-- if you change `runInTerminal` to true, you might need to change the yama/ptrace_scope setting:
|
-- if you change `runInTerminal` to true, you might need to change the yama/ptrace_scope setting:
|
||||||
@ -57,11 +56,11 @@ dap.configurations.rust = dap.configurations.cpp
|
|||||||
|
|
||||||
dap.configurations.cs = {
|
dap.configurations.cs = {
|
||||||
{
|
{
|
||||||
type = 'coreclr',
|
type = "coreclr",
|
||||||
name = 'launch - netcoredbg',
|
name = "launch - netcoredbg",
|
||||||
request = 'launch',
|
request = "launch",
|
||||||
program = function()
|
program = function()
|
||||||
return vim.fn.input('Path to dll: ', vim.fn.getcwd() .. '/bin/Debug/', 'file')
|
return vim.fn.input("Path to dll: ", vim.fn.getcwd() .. "/bin/Debug/", "file")
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -249,7 +249,7 @@ lspconfig.yamlls.setup({
|
|||||||
|
|
||||||
lspconfig.omnisharp.setup({
|
lspconfig.omnisharp.setup({
|
||||||
cmd = {
|
cmd = {
|
||||||
os.getenv("HOME") .. "/.local/share/nvim/mason/bin/omnisharp",
|
vim.fn.stdpath("data") .. "/mason/bin/omnisharp",
|
||||||
"--languageserver",
|
"--languageserver",
|
||||||
"--hostPID",
|
"--hostPID",
|
||||||
tostring(vim.fn.getpid()),
|
tostring(vim.fn.getpid()),
|
||||||
|
Loading…
Reference in New Issue
Block a user