add symbols outline, bit of dap

This commit is contained in:
Markus Dieckmann 2022-11-25 17:37:44 +01:00
parent 623a20302e
commit 218c64abd7
4 changed files with 154 additions and 25 deletions

View File

@ -17,3 +17,4 @@ require("telescope_config")
require("nvimtest_config") require("nvimtest_config")
require("neotest_config") require("neotest_config")
require("trouble_config") require("trouble_config")
require("symbols_outline")

View File

@ -1,27 +1,79 @@
vim.fn.sign_define('DapBreakpoint', {text='🟥', texthl='', linehl='', numhl=''}) vim.fn.sign_define('DapBreakpoint', {text='🟥', texthl='', linehl='', numhl=''})
vim.fn.sign_define('DapStopped', {text='⭐️', texthl='', linehl='', numhl=''}) vim.fn.sign_define('DapStopped', {text='⭐️', texthl='', linehl='', numhl=''})
local dap = require('dap') local dap = require('dap')
dap.adapters.node2 = {
type = 'executable', local M ={}
command = 'node',
args = {os.getenv('HOME') .. '/dev/microsoft/vscode-node-debug2/out/src/nodeDebug.js'}, local DEBUGGER_PATH = {os.getenv('HOME')..'/.local/share/nvim/mason/packages/js-debug-adapter'}
function M.setup()
require('dap-vscode-js').setup {
node_path = "node",
debugger_path = DEBUGGER_PATH,
adapters = {"pwa-node","pwa-chrome","pwa-msedge","node-terminal", "pwa-extensionHost"}
} }
dap.configurations.javascript = { for _, language in ipairs {"typescript", "javascript"} do
{ dap.configurations[language] = {
name = 'Launch', type = "pwa-node",
type = 'node2', request = "launch",
request = 'launch', name = "Launch File",
program = '${file}', program = "${file}",
cwd = vim.fn.getcwd(), cwd = "${workspacefolder}"
sourceMaps = true,
protocol = 'inspector',
console = 'integratedTerminal',
}, },
{ {
-- For this to work you need to make sure the node process is started with the `--inspect` flag. type = "pwa-node",
name = 'Attach to process', request = "attach",
type = 'node2', name = "Attach",
request = 'attach', processId = require("dap.utils").pick_process,
processId = require'dap.utils'.pick_process, cwd = "${workspacefolder}"
}, },
{
type = "pwa-node",
request = "launch",
name = "Debug Jest Tests",
runtimeExecutable = "node",
runtimeArgs = {
"./node_modules/jest/bin/jestj",
"--runInBand",
},
rootPath = "${workspaceFolder}",
console = "integratedTerminal",
internalConsoleOptions = "neverOpen",
cwd = "${workspacefolder}"
} }
end
end
local function configure_debuggers()
require("config.dap.javascript").setup()
require("config.dap.typescript").setup()
end
return M
--dap.adapters.node2 = {
-- type = 'executable',
-- command = 'node',
-- args = {os.getenv('HOME') .. '/.local/share/nvim/mason/packages/node-debug2-adapter/out/src/nodeDebug.js'},
--}
--dap.configurations.javascript = {
-- {
-- name = 'Launch',
-- type = 'node2',
-- request = 'launch',
-- program = '${file}',
-- cwd = vim.fn.getcwd(),
-- sourceMaps = true,
-- protocol = 'inspector',
-- console = 'integratedTerminal',
-- },
-- {
-- -- For this to work you need to make sure the node process is started with the `--inspect` flag.
-- name = 'Attach to process',
-- type = 'node2',
-- request = 'attach',
-- processId = require'dap.utils'.pick_process,
-- },
--}

View File

@ -6,7 +6,16 @@ require("packer").startup(function(use)
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
"WhoIsSethDaniel/mason-tool-installer.nvim", "WhoIsSethDaniel/mason-tool-installer.nvim",
}) })
use({ "rcarriga/nvim-dap-ui", requires = { "mfussenegger/nvim-dap" } }) use { "mfussenegger/nvim-dap",
requires = {
"theHamsta/nvim-dap-virtual-text",
"rcarriga/nvim-dap-ui",
"mfussenegger/nvim-dap-python",
"nvim-telescope/telescope-dap.nvim",
{ "jbyuki/one-small-step-for-vimkind", module = "osv" },
{ "mxsdev/nvim-dap-vscode-js" },
}
}
use("jose-elias-alvarez/null-ls.nvim") use("jose-elias-alvarez/null-ls.nvim")
use({ use({
"nvim-telescope/telescope.nvim", "nvim-telescope/telescope.nvim",
@ -91,4 +100,9 @@ require("packer").startup(function(use)
"folke/trouble.nvim", "folke/trouble.nvim",
requires = "kyazdani42/nvim-web-devicons" requires = "kyazdani42/nvim-web-devicons"
} }
use {
'kkoomen/vim-doge',
run = ':call doge#install()'
}
use 'simrat39/symbols-outline.nvim'
end) end)

View File

@ -0,0 +1,62 @@
local opts = {
highlight_hovered_item = true,
show_guides = true,
auto_preview = false,
position = 'right',
relative_width = true,
width = 25,
auto_close = false,
show_numbers = false,
show_relative_numbers = false,
show_symbol_details = true,
preview_bg_highlight = 'Pmenu',
autofold_depth = nil,
auto_unfold_hover = true,
fold_markers = { '', '' },
wrap = false,
keymaps = { -- These keymaps can be a string or a table for multiple keys
close = {"<Esc>", "q"},
goto_location = "<Cr>",
focus_location = "o",
hover_symbol = "<C-space>",
toggle_preview = "K",
rename_symbol = "r",
code_actions = "a",
fold = "h",
unfold = "l",
fold_all = "W",
unfold_all = "E",
fold_reset = "R",
},
lsp_blacklist = {},
symbol_blacklist = {},
symbols = {
File = {icon = "", hl = "TSURI"},
Module = {icon = "", hl = "TSNamespace"},
Namespace = {icon = "", hl = "TSNamespace"},
Package = {icon = "", hl = "TSNamespace"},
Class = {icon = "𝓒", hl = "TSType"},
Method = {icon = "ƒ", hl = "TSMethod"},
Property = {icon = "", hl = "TSMethod"},
Field = {icon = "", hl = "TSField"},
Constructor = {icon = "", hl = "TSConstructor"},
Enum = {icon = "", hl = "TSType"},
Interface = {icon = "", hl = "TSType"},
Function = {icon = "", hl = "TSFunction"},
Variable = {icon = "", hl = "TSConstant"},
Constant = {icon = "", hl = "TSConstant"},
String = {icon = "𝓐", hl = "TSString"},
Number = {icon = "#", hl = "TSNumber"},
Boolean = {icon = "", hl = "TSBoolean"},
Array = {icon = "", hl = "TSConstant"},
Object = {icon = "⦿", hl = "TSType"},
Key = {icon = "🔐", hl = "TSType"},
Null = {icon = "NULL", hl = "TSType"},
EnumMember = {icon = "", hl = "TSField"},
Struct = {icon = "𝓢", hl = "TSType"},
Event = {icon = "🗲", hl = "TSType"},
Operator = {icon = "+", hl = "TSOperator"},
TypeParameter = {icon = "𝙏", hl = "TSParameter"}
}
}
require("symbols-outline").setup(opts)