From 218c64abd70d7e8b265e257155dcb90174e9ee79 Mon Sep 17 00:00:00 2001 From: Markus Dieckmann Date: Fri, 25 Nov 2022 17:37:44 +0100 Subject: [PATCH] add symbols outline, bit of dap --- nvim/init.lua | 1 + nvim/lua/dap_config.lua | 100 ++++++++++++++++++++++++++--------- nvim/lua/plugins.lua | 16 +++++- nvim/lua/symbols_outline.lua | 62 ++++++++++++++++++++++ 4 files changed, 154 insertions(+), 25 deletions(-) create mode 100644 nvim/lua/symbols_outline.lua diff --git a/nvim/init.lua b/nvim/init.lua index 47bed69..3d232be 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -17,3 +17,4 @@ require("telescope_config") require("nvimtest_config") require("neotest_config") require("trouble_config") +require("symbols_outline") diff --git a/nvim/lua/dap_config.lua b/nvim/lua/dap_config.lua index 504e642..ac8919d 100644 --- a/nvim/lua/dap_config.lua +++ b/nvim/lua/dap_config.lua @@ -1,27 +1,79 @@ vim.fn.sign_define('DapBreakpoint', {text='🟥', texthl='', linehl='', numhl=''}) vim.fn.sign_define('DapStopped', {text='⭐️', texthl='', linehl='', numhl=''}) local dap = require('dap') -dap.adapters.node2 = { - type = 'executable', - command = 'node', - args = {os.getenv('HOME') .. '/dev/microsoft/vscode-node-debug2/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, - }, -} + +local M ={} + +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"} + } + for _, language in ipairs {"typescript", "javascript"} do + dap.configurations[language] = { + type = "pwa-node", + request = "launch", + name = "Launch File", + program = "${file}", + cwd = "${workspacefolder}" + }, + { + type = "pwa-node", + request = "attach", + name = "Attach", + 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, +-- }, +--} diff --git a/nvim/lua/plugins.lua b/nvim/lua/plugins.lua index 14c7964..4b3d6a5 100644 --- a/nvim/lua/plugins.lua +++ b/nvim/lua/plugins.lua @@ -6,7 +6,16 @@ require("packer").startup(function(use) "neovim/nvim-lspconfig", "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({ "nvim-telescope/telescope.nvim", @@ -91,4 +100,9 @@ require("packer").startup(function(use) "folke/trouble.nvim", requires = "kyazdani42/nvim-web-devicons" } + use { + 'kkoomen/vim-doge', + run = ':call doge#install()' + } + use 'simrat39/symbols-outline.nvim' end) diff --git a/nvim/lua/symbols_outline.lua b/nvim/lua/symbols_outline.lua new file mode 100644 index 0000000..1172a6f --- /dev/null +++ b/nvim/lua/symbols_outline.lua @@ -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 = {"", "q"}, + goto_location = "", + focus_location = "o", + hover_symbol = "", + 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)