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 async = require('plenary.async')
|
||||
local dap = require("dap")
|
||||
local async = require("plenary.async")
|
||||
|
||||
--- Gets a path for a given program in the environment
|
||||
---@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 home = os.getenv('HOME')
|
||||
local program_path = home .. '/.local/share/nvim/mason/packages/' .. program .. '/' .. program
|
||||
local program_path = vim.fn.stdpath("data") .. "/mason/packages/" .. program .. "/" .. program
|
||||
return program_path
|
||||
end
|
||||
|
||||
local lldb_path = get_program_path('lldb-vscode')
|
||||
local lldb_path = get_program_path("lldb-vscode")
|
||||
-- Adapaters
|
||||
dap.adapters.lldb = {
|
||||
type = 'executable',
|
||||
type = "executable",
|
||||
command = lldb_path,
|
||||
name = 'lldb',
|
||||
name = "lldb",
|
||||
}
|
||||
|
||||
dap.adapters.coreclr = {
|
||||
type = 'executable',
|
||||
command = get_program_path('netcoredbg'),
|
||||
args = { '--interpreter=vscode' },
|
||||
type = "executable",
|
||||
command = get_program_path("netcoredbg"),
|
||||
args = { "--interpreter=vscode" },
|
||||
}
|
||||
|
||||
-- configurations
|
||||
dap.configurations.cpp = {
|
||||
{
|
||||
name = 'Launch',
|
||||
type = 'lldb',
|
||||
request = 'launch',
|
||||
name = "Launch",
|
||||
type = "lldb",
|
||||
request = "launch",
|
||||
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,
|
||||
cwd = '${workspaceFolder}',
|
||||
cwd = "${workspaceFolder}",
|
||||
stopOnEntry = false,
|
||||
targetArchitecture = 'arm64',
|
||||
targetArchitecture = "arm64",
|
||||
args = {},
|
||||
|
||||
-- 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 = {
|
||||
{
|
||||
type = 'coreclr',
|
||||
name = 'launch - netcoredbg',
|
||||
request = 'launch',
|
||||
type = "coreclr",
|
||||
name = "launch - netcoredbg",
|
||||
request = "launch",
|
||||
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,
|
||||
},
|
||||
}
|
||||
|
@ -249,7 +249,7 @@ lspconfig.yamlls.setup({
|
||||
|
||||
lspconfig.omnisharp.setup({
|
||||
cmd = {
|
||||
os.getenv("HOME") .. "/.local/share/nvim/mason/bin/omnisharp",
|
||||
vim.fn.stdpath("data") .. "/mason/bin/omnisharp",
|
||||
"--languageserver",
|
||||
"--hostPID",
|
||||
tostring(vim.fn.getpid()),
|
||||
|
Loading…
Reference in New Issue
Block a user