From 2e36ef05d9e869fcb52221f36ba803a47d51e781 Mon Sep 17 00:00:00 2001 From: Oscar Wallberg Date: Sat, 20 Apr 2024 15:17:00 +0200 Subject: [PATCH] feat(dap): remove dap not used --- lua/plugins.lua | 12 ------ lua/plugins/dap.lua | 87 ------------------------------------------ lua/plugins/dap_ui.lua | 47 ----------------------- lua/pytest.lua | 55 -------------------------- 4 files changed, 201 deletions(-) delete mode 100644 lua/plugins/dap.lua delete mode 100644 lua/plugins/dap_ui.lua delete mode 100644 lua/pytest.lua diff --git a/lua/plugins.lua b/lua/plugins.lua index e492eb6..8f3c594 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -76,18 +76,6 @@ local plugins = { lazy = true, event = "VimEnter", }, - { - "mfussenegger/nvim-dap", - config = require("plugins.dap").setup, - }, - { - "rcarriga/nvim-dap-ui", - config = require("plugins.dap_ui"), - dependencies = { - "mfussenegger/nvim-dap", - "nvim-neotest/nvim-nio", - }, - }, { "tpope/vim-fugitive", config = require("plugins.fugitive"), diff --git a/lua/plugins/dap.lua b/lua/plugins/dap.lua deleted file mode 100644 index 01aff70..0000000 --- a/lua/plugins/dap.lua +++ /dev/null @@ -1,87 +0,0 @@ --- https://github.com/mfussenegger/nvim-dap - -local M = {} - -M.env_ok = false - -function M.check_env() - local utils = require("utils") - - utils.assert_installed("python3") - utils.assert_python3_module_installed("debugpy") - M.env_ok = true -end - -function M.start(config) - local dap = require("dap") - - if not M.env_ok then - M:check_env() - end - - dap.adapters.python = { - type = "executable", - command = "python", - args = { "-m", "debugpy.adapter", }, - cwd = vim.fn.getcwd(), - } - dap.run(config) - -- List of events described at https://microsoft.github.io/debug-adapter-protocol/specification#Events - -- Also see :h dap-extensions - dap.listeners.after["event_initialized"]["nvim-dap.lua"] = function () - dap.set_exception_breakpoints({ "userUnhandled", }) - end -end - -function M.launch(args) - assert(type(args) == "table", "Args not specified or of wrong type") - local config = { - name = "Launch file", - type = "python", - request = "launch", - program = "${file}", - -- python = 'python'; - -- program = vim.fn.getcwd() .. '/.venv/bin/pytest'; - console = "integratedTerminal", - args = args, - } - M.start(config) -end - -function M.pytest(args) - assert(type(args) == "table", "Args not specified or of wrong type") - local config = { - name = "pytest " .. table.concat(args, " "), - type = "python", - request = "launch", - - -- pythonPath = vim.fn.getcwd() .. '/.venv/bin/python', - module = "pytest", - -- python = 'python'; - -- program = vim.fn.getcwd() .. '/.venv/bin/pytest'; - args = args, - console = "integratedTerminal", - -- program = "${file}"; - } - M.start(config) -end - -function M.setup() - local dap = require("dap") - - vim.keymap.set("n", "", dap.continue) - vim.keymap.set("n", "", dap.step_over) - vim.keymap.set("n", "", dap.step_into) - vim.keymap.set("n", "", dap.step_out) - - --[[ - TODO: Add this after loading dap for integrating catppuccin: - local sign = vim.fn.sign_define - - sign("DapBreakpoint", { text = "●", texthl = "DapBreakpoint", linehl = "", numhl = ""}) - sign("DapBreakpointCondition", { text = "●", texthl = "DapBreakpointCondition", linehl = "", numhl = ""}) - sign("DapLogPoint", { text = "◆", texthl = "DapLogPoint", linehl = "", numhl = ""}) - --]] -end - -return M diff --git a/lua/plugins/dap_ui.lua b/lua/plugins/dap_ui.lua deleted file mode 100644 index 12b27f3..0000000 --- a/lua/plugins/dap_ui.lua +++ /dev/null @@ -1,47 +0,0 @@ --- https://github.com/rcarriga/nvim-dap-ui - -local function setup() - require("dapui").setup({ - icons = { expanded = "▾", collapsed = "▸", }, - mappings = { - -- Use a table to apply multiple mappings - expand = { "", "<2-LeftMouse>", }, - open = "o", - remove = "d", - edit = "e", - repl = "r", - toggle = "t", - }, - layouts = { - { - elements = { - "scopes", - "breakpoints", - "stacks", - "watches", - }, - size = 40, - position = "left", - }, - { - elements = { - "repl", - "console", - }, - size = 10, - position = "bottom", - }, - }, - floating = { - max_height = nil, -- These can be integers or a float between 0 and 1. - max_width = nil, -- Floats will be treated as percentage of your screen. - border = "single", -- Border style. Can be "single", "double" or "rounded" - mappings = { - close = { "q", "", }, - }, - }, - windows = { indent = 1, }, - }) -end - -return setup diff --git a/lua/pytest.lua b/lua/pytest.lua deleted file mode 100644 index 8801f65..0000000 --- a/lua/pytest.lua +++ /dev/null @@ -1,55 +0,0 @@ --- TODO: clean this up. --- For other readers: I don't currently use this, and is probably broken. --- This was started as a work in progress a long time ago. - -local utils = require("utils") - -local M = {} - -local env_ok = false -local dap = nil - -local function check_env() - utils.assert_installed("python3") - utils.assert_python3_module_installed("debugpy") - utils.assert_python3_module_installed("pytest") - env_ok = true -end - -function M.run(args) - assert(type(args) == "table", "Args not specified or of wrong type") - if not env_ok then - check_env() - end - if not dap then - dap = require("dap") - dap.adapters.python = { - type = "executable", - command = "python3", - args = { "-m", "debugpy.adapter", }, - cwd = vim.fn.getcwd(), - } - end - local config = { - name = "pytest " .. table.concat(args, " "), - type = "python", - request = "launch", - - -- pythonPath = vim.fn.getcwd() .. '/.venv/bin/python', - module = "pytest", - -- python = 'python'; - -- program = vim.fn.getcwd() .. '/.venv/bin/pytest'; - args = args, - console = "integratedTerminal", - -- program = "${file}"; - } - -- session = dap.launch(adapter, config) - dap.run(config) - -- List of events described at https://microsoft.github.io/debug-adapter-protocol/specification#Events - -- Also see :h dap-extensions - dap.listeners.after["event_initialized"]["pytest.lua"] = function (_, _) - dap.set_exception_breakpoints({ "userUnhandled", }) - end -end - -return M