feat: add codelldb
This commit is contained in:
parent
14c9fc6498
commit
9aba78a4a3
6 changed files with 140 additions and 207 deletions
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"trailingComma": "all",
|
||||
"tabWidth": 2,
|
||||
"tabWidth": 4,
|
||||
"semi": true,
|
||||
"singleQuote": false
|
||||
"singleQuote": true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,48 +1,45 @@
|
|||
local dap = require('dap')
|
||||
dap.adapters.cppdbg = {
|
||||
id = 'cppdbg',
|
||||
type = 'executable',
|
||||
command = '/home/dashie/.config/nvim/plugged/cpptools/extension/debugAdapters/bin/OpenDebugAD7',
|
||||
local dap = require("dap")
|
||||
dap.adapters.codelldb = {
|
||||
type = "server",
|
||||
port = "${port}",
|
||||
executable = {
|
||||
-- CHANGE THIS to your path!
|
||||
command = "/home/dashie/.local/share/nvim/mason/packages/codelldb/extension/adapter/codelldb",
|
||||
args = { "--port", "${port}" },
|
||||
},
|
||||
}
|
||||
|
||||
local rust_dap = vim.fn.getcwd()
|
||||
local filename = ""
|
||||
for w in rust_dap:gmatch("([^/]+)") do filename = w end
|
||||
|
||||
dap.configurations.rust = {
|
||||
{
|
||||
type = "codelldb",
|
||||
request = "launch",
|
||||
program = function()
|
||||
return rust_dap .. "/target/debug/" .. filename
|
||||
end,
|
||||
--program = '${fileDirname}/${fileBasenameNoExtension}',
|
||||
cwd = "${workspaceFolder}",
|
||||
stopOnEntry = true,
|
||||
terminal = "integrated",
|
||||
},
|
||||
}
|
||||
|
||||
dap.configurations.cpp = {
|
||||
{
|
||||
name = "Launch file",
|
||||
type = "cppdbg",
|
||||
type = "codelldb",
|
||||
request = "launch",
|
||||
program = function()
|
||||
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/build/', 'file')
|
||||
end,
|
||||
cwd = '${workspaceFolder}',
|
||||
stopAtEntry = true,
|
||||
},
|
||||
{
|
||||
name = "Launch file --gui",
|
||||
type = "cppdbg",
|
||||
request = "launch",
|
||||
program = function()
|
||||
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/build/', 'file')
|
||||
end,
|
||||
args = {'--gui'},
|
||||
cwd = '${workspaceFolder}',
|
||||
stopAtEntry = true,
|
||||
},
|
||||
{
|
||||
name = 'Attach to gdbserver :1234',
|
||||
type = 'cppdbg',
|
||||
request = 'launch',
|
||||
MIMode = 'gdb',
|
||||
miDebuggerServerAddress = 'localhost:1234',
|
||||
miDebuggerPath = '/usr/bin/gdb',
|
||||
cwd = '${workspaceFolder}',
|
||||
program = function()
|
||||
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/build/', 'file')
|
||||
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/build/", "file")
|
||||
end,
|
||||
--program = '${fileDirname}/${fileBasenameNoExtension}',
|
||||
cwd = "${workspaceFolder}",
|
||||
terminal = "integrated",
|
||||
},
|
||||
}
|
||||
|
||||
dap.configurations.c = dap.configurations.cpp
|
||||
dap.configurations.rust = dap.configurations.cpp
|
||||
|
||||
require("dapui").setup({
|
||||
icons = { expanded = "▾", collapsed = "▸", current_frame = "▸" },
|
||||
|
|
@ -114,13 +111,14 @@ require("dapui").setup({
|
|||
render = {
|
||||
max_type_length = nil, -- Can be integer or nil.
|
||||
max_value_lines = 100, -- Can be integer or nil.
|
||||
}
|
||||
},
|
||||
})
|
||||
require("mason-nvim-dap").setup({
|
||||
ensure_installed = { "cpptools",
|
||||
ensure_installed = {
|
||||
"codelldb",
|
||||
"bash-debug-adapter",
|
||||
"firefox-debug-adapter",
|
||||
"js-debug-adapter",
|
||||
"node-debug2-adapter"
|
||||
}
|
||||
"node-debug2-adapter",
|
||||
},
|
||||
})
|
||||
|
|
|
|||
|
|
@ -7,16 +7,15 @@ local keymap = vim.api.nvim_set_keymap
|
|||
--vim.lsp.handlers["textDocument/codeAction"] = require'lspactions'.codeaction
|
||||
--vim.cmd [[ nnoremap <leader>af :lua require'lspactions'.code_action()<CR> ]]
|
||||
|
||||
keymap("n", "<M-CR>", ":CodeActionMenu<CR>", opts)
|
||||
-- keymap("n", "<M-CR>", ":CodeActionMenu<CR>", opts)
|
||||
keymap("n", "<C-f>", "<cmd>TroubleToggle<CR>", term_opts)
|
||||
keymap("n", "<C-g>", ':lua require("vgit").buffer_hunk_preview()<CR>', opts)
|
||||
--keymap("n", "<C-b>", ':lua require("vgit").buffer_stage()<CR>', opts)
|
||||
keymap("n", "<F5>", ':lua require("dap").toggle_breakpoint()<CR>', opts)
|
||||
keymap("n", "<F6>", ':lua require("dap").step_over()<CR>', opts)
|
||||
keymap("n", "<F7>", ':lua require("dap").step_into()<CR>', opts)
|
||||
keymap("n", "<F8>", ':lua require("dap").continue()<CR>', opts)
|
||||
keymap("n", "<F9>", ':lua require("dap").close()<CR> :lua require("dapui").toggle()<CR>', opts)
|
||||
keymap("n", "<F10>", ':lua require("dap").continue()<CR> :lua require("dapui").toggle()<CR>', opts)
|
||||
keymap("n", "<F8>", ':lua require("dap").continue()<CR> :lua require("dapui").toggle()<CR>', opts)
|
||||
keymap("n", "<F9>", ':lua require("dap").continue()<CR>', opts)
|
||||
keymap("n", "<F10>", ':lua require("dap").close()<CR> :lua require("dapui").toggle()<CR>', opts)
|
||||
|
||||
keymap("n", "t", ':lua require("nvim-tree").toggle()<CR>', opts)
|
||||
keymap("n", "f", ':lua require("nvim-tree").focus()<CR>', opts)
|
||||
|
|
|
|||
|
|
@ -17,9 +17,8 @@ require("mason-lspconfig").setup({
|
|||
ensure_installed = {
|
||||
"cssls", -- css
|
||||
"html", -- html
|
||||
"eslint", -- latex
|
||||
"clangd", -- cpp / c
|
||||
--"tsserver", -- python
|
||||
"tsserver", -- python
|
||||
"texlab", -- latex
|
||||
"sumneko_lua", -- lua
|
||||
"pyright", -- python
|
||||
|
|
@ -28,86 +27,27 @@ require("mason-lspconfig").setup({
|
|||
"cmake", -- cmake
|
||||
"bashls", -- shell
|
||||
"ansiblels", -- ansible
|
||||
"csharp_ls", -- dotnot
|
||||
"omnisharp", -- dotnot
|
||||
"hls", -- haskel
|
||||
},
|
||||
automatic_installation = true,
|
||||
})
|
||||
|
||||
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||
|
||||
require("lspconfig")["cssls"].setup({
|
||||
local on_attach = function(client, bufnr)
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
|
||||
local opts = { noremap = true, silent = true, buffer=bufnr }
|
||||
vim.keymap.set("n", "<C-k>", "<Cmd>lua vim.lsp.buf.hover()<CR>", opts)
|
||||
vim.keymap.set("n", "<M-CR>", "<Cmd>lua vim.lsp.buf.code_action<CR>", opts)
|
||||
end
|
||||
|
||||
require("mason-lspconfig").setup_handlers({
|
||||
function(server_name) -- default handler (optional)
|
||||
require("lspconfig")[server_name].setup({
|
||||
capabilities = capabilities,
|
||||
--on_attach = on_attach,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
require("lspconfig")["html"].setup({
|
||||
capabilities = capabilities,
|
||||
--on_attach = on_attach,
|
||||
end,
|
||||
})
|
||||
|
||||
require("lspconfig")["eslint"].setup({
|
||||
capabilities = capabilities,
|
||||
--on_attach = on_attach,
|
||||
})
|
||||
|
||||
require("lspconfig")["clangd"].setup({
|
||||
capabilities = capabilities,
|
||||
--on_attach = on_attach,
|
||||
})
|
||||
|
||||
--require("lspconfig")["tsserver"].setup({
|
||||
-- capabilities = capabilities,
|
||||
--on_attach = on_attach,
|
||||
--})
|
||||
|
||||
require("lspconfig")["texlab"].setup({
|
||||
capabilities = capabilities,
|
||||
--on_attach = on_attach,
|
||||
})
|
||||
|
||||
require("lspconfig")["sumneko_lua"].setup({
|
||||
capabilities = capabilities,
|
||||
--on_attach = on_attach,
|
||||
})
|
||||
|
||||
require("lspconfig")["pyright"].setup({
|
||||
capabilities = capabilities,
|
||||
--on_attach = on_attach,
|
||||
})
|
||||
|
||||
require("lspconfig")["rust_analyzer"].setup({
|
||||
capabilities = capabilities,
|
||||
--on_attach = on_attach,
|
||||
})
|
||||
|
||||
require("lspconfig")["jdtls"].setup({
|
||||
capabilities = capabilities,
|
||||
--on_attach = on_attach,
|
||||
})
|
||||
|
||||
require("lspconfig")["cmake"].setup({
|
||||
capabilities = capabilities,
|
||||
--on_attach = on_attach,
|
||||
})
|
||||
|
||||
require("lspconfig")["bashls"].setup({
|
||||
capabilities = capabilities,
|
||||
--on_attach = on_attach,
|
||||
})
|
||||
|
||||
require("lspconfig")["ansiblels"].setup({
|
||||
capabilities = capabilities,
|
||||
--on_attach = on_attach,
|
||||
})
|
||||
|
||||
require("lspconfig")["csharp_ls"].setup({
|
||||
capabilities = capabilities,
|
||||
--on_attach = on_attach,
|
||||
})
|
||||
|
||||
require("lspconfig")["hls"].setup({
|
||||
capabilities = capabilities,
|
||||
--on_attach = on_attach,
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
local options = {
|
||||
clipboard = "unnamedplus",
|
||||
mouse = "a",
|
||||
mouse = "n",
|
||||
fileencoding = "utf-8",
|
||||
relativenumber = true,
|
||||
cursorline = false,
|
||||
|
|
|
|||
|
|
@ -44,9 +44,5 @@ Plug("nvim-telescope/telescope-ui-select.nvim") -- telescope ui
|
|||
Plug("nvim-telescope/telescope-file-browser.nvim") -- telescope file browser
|
||||
Plug("nvim-telescope/telescope-fzy-native.nvim") -- telescope fuzzy search
|
||||
Plug 'folke/trouble.nvim' -- provides warning/error explanation tab
|
||||
--Plug("folke/twilight.nvim") --twilight dims code not being edited right now ? useless ?
|
||||
--Plug("lambdalisue/fern.vim") -- likely not needed?
|
||||
--Plug("MarcWeber/vim-addon-mw-utils") -- wtf?
|
||||
--Plug("tomtom/tlib_vim") --wtf2?
|
||||
vim.call("plug#end")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue