aboutsummaryrefslogtreecommitdiffstats
path: root/lua/alpha/dap.lua
diff options
context:
space:
mode:
authorAriel D'Alessandro <dalessandro.ariel@gmail.com>2023-01-31 09:44:13 +0100
committerAriel D'Alessandro <dalessandro.ariel@gmail.com>2023-01-31 09:44:13 +0100
commit669561e21073e6efafddda25ba3ace69fb43819e (patch)
treef94ebd60ad4cab480b5cbcb7e65dd2060696c339 /lua/alpha/dap.lua
parent5044c70e9f62cdd06ee91e754423b07c1c18c12d (diff)
downloadnvim-conf-669561e21073e6efafddda25ba3ace69fb43819e.tar.gz
nvim-conf-669561e21073e6efafddda25ba3ace69fb43819e.zip
feat: apply stylua
Diffstat (limited to 'lua/alpha/dap.lua')
-rw-r--r--lua/alpha/dap.lua272
1 files changed, 136 insertions, 136 deletions
diff --git a/lua/alpha/dap.lua b/lua/alpha/dap.lua
index ee53443..a89d72e 100644
--- a/lua/alpha/dap.lua
+++ b/lua/alpha/dap.lua
@@ -1,33 +1,33 @@
-local dap, dapui, dap_go = require("dap"), require("dapui"), require("dap-go")
+local dap, dapui, dap_go = require "dap", require "dapui", require "dap-go"
-require("nvim-dap-virtual-text").setup({})
+require("nvim-dap-virtual-text").setup {}
-- dap.set_log_level('TRACE')
dap_go.setup()
-dapui.setup({
- icons = { expanded = "▾", collapsed = "▸" },
- layouts = {
- {
- elements = {
- "scopes",
- "breakpoints",
- "stacks",
- "watches",
- },
- size = 80,
- position = "left",
- },
- {
- elements = {
- "repl",
- "console",
- },
- size = 10,
- position = "bottom",
- },
- },
-})
+dapui.setup {
+ icons = { expanded = "▾", collapsed = "▸" },
+ layouts = {
+ {
+ elements = {
+ "scopes",
+ "breakpoints",
+ "stacks",
+ "watches",
+ },
+ size = 80,
+ position = "left",
+ },
+ {
+ elements = {
+ "repl",
+ "console",
+ },
+ size = 10,
+ position = "bottom",
+ },
+ },
+}
vim.fn.sign_define("DapBreakpoint", { text = "🛑", texthl = "", linehl = "", numhl = "" })
vim.fn.sign_define("DapStopped", { text = "▶", texthl = "", linehl = "", numhl = "" })
@@ -36,83 +36,83 @@ vim.fn.sign_define("DapBreakpointCondition", { text = "❓", texthl = "", linehl
vim.fn.sign_define("DapLogPoint", { text = "💬", texthl = "", linehl = "", numhl = "" })
dap.adapters.php = {
- type = "executable",
- command = "php-debug-adapter",
+ type = "executable",
+ command = "php-debug-adapter",
}
dap.configurations.php = {
- {
- type = "php",
- request = "launch",
- name = "Laravel",
- port = 9003,
- pathMappings = {
- ["/var/www/html"] = "${workspaceFolder}",
- },
- },
- {
- type = "php",
- request = "launch",
- name = "Symfony",
- port = 9003,
- pathMappings = {
- ["/app"] = "${workspaceFolder}",
- },
- },
+ {
+ type = "php",
+ request = "launch",
+ name = "Laravel",
+ port = 9003,
+ pathMappings = {
+ ["/var/www/html"] = "${workspaceFolder}",
+ },
+ },
+ {
+ type = "php",
+ request = "launch",
+ name = "Symfony",
+ port = 9003,
+ pathMappings = {
+ ["/app"] = "${workspaceFolder}",
+ },
+ },
}
-require("dap-vscode-js").setup({
- debugger_cmd = { "js-debug-adapter" },
- adapters = { "pwa-node", "pwa-chrome", "node-terminal" },
-})
+require("dap-vscode-js").setup {
+ debugger_cmd = { "js-debug-adapter" },
+ adapters = { "pwa-node", "pwa-chrome", "node-terminal" },
+}
-for _, language in ipairs({ "typescript", "javascript" }) do
- require("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}",
- },
- }
+for _, language in ipairs { "typescript", "javascript" } do
+ require("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}",
+ },
+ }
end
-for _, language in ipairs({ "typescriptreact", "javascriptreact" }) do
- require("dap").configurations[language] = {
- {
- type = "pwa-chrome",
- name = "Attach - Remote Debugging",
- request = "attach",
- program = "${file}",
- cwd = vim.fn.getcwd(),
- sourceMaps = true,
- protocol = "inspector",
- port = 9222,
- webRoot = "${workspaceFolder}",
- },
- {
- type = "pwa-chrome",
- name = "Launch Chrome",
- request = "launch",
- url = "http://localhost:3000",
- },
- }
+for _, language in ipairs { "typescriptreact", "javascriptreact" } do
+ require("dap").configurations[language] = {
+ {
+ type = "pwa-chrome",
+ name = "Attach - Remote Debugging",
+ request = "attach",
+ program = "${file}",
+ cwd = vim.fn.getcwd(),
+ sourceMaps = true,
+ protocol = "inspector",
+ port = 9222,
+ webRoot = "${workspaceFolder}",
+ },
+ {
+ type = "pwa-chrome",
+ name = "Launch Chrome",
+ request = "launch",
+ url = "http://localhost:3000",
+ },
+ }
end
-- Events Listeners
dap.listeners.after.event_initialized["dapui_config"] = function()
- dapui.open({})
+ dapui.open {}
end
-local hydra = require("hydra")
+local hydra = require "hydra"
local hint = [[
Nvim DAP
_d_: Start/Continue _j_: StepOver _k_: StepOut _l_: StepInto ^
@@ -124,52 +124,52 @@ local hint = [[
^^ _<Esc>_
]]
-hydra({
- name = "dap",
- hint = hint,
- mode = "n",
- config = {
- color = "blue",
- invoke_on_body = true,
- hint = {
- border = "rounded",
- position = "bottom",
- },
- },
- body = "<leader>d",
- heads = {
- { "d", dap.continue },
- { "bp", dap.toggle_breakpoint },
- { "l", dap.step_into },
- { "j", dap.step_over },
- { "k", dap.step_out },
- { "h", dapui.eval },
- { "c", dap.run_to_cursor },
- {
- "bc",
- function()
- vim.ui.input({ prompt = "Condition: " }, function(condition)
- dap.set_breakpoint(condition)
- end)
- end,
- },
- {
- "?",
- function()
- vim.ui.input({ prompt = "Log: " }, function(log)
- dap.set_breakpoint(nil, nil, log)
- end)
- end,
- },
- {
- "x",
- function()
- dap.terminate()
- dapui.close({})
- dap.clear_breakpoints()
- end,
- },
+hydra {
+ name = "dap",
+ hint = hint,
+ mode = "n",
+ config = {
+ color = "blue",
+ invoke_on_body = true,
+ hint = {
+ border = "rounded",
+ position = "bottom",
+ },
+ },
+ body = "<leader>d",
+ heads = {
+ { "d", dap.continue },
+ { "bp", dap.toggle_breakpoint },
+ { "l", dap.step_into },
+ { "j", dap.step_over },
+ { "k", dap.step_out },
+ { "h", dapui.eval },
+ { "c", dap.run_to_cursor },
+ {
+ "bc",
+ function()
+ vim.ui.input({ prompt = "Condition: " }, function(condition)
+ dap.set_breakpoint(condition)
+ end)
+ end,
+ },
+ {
+ "?",
+ function()
+ vim.ui.input({ prompt = "Log: " }, function(log)
+ dap.set_breakpoint(nil, nil, log)
+ end)
+ end,
+ },
+ {
+ "x",
+ function()
+ dap.terminate()
+ dapui.close {}
+ dap.clear_breakpoints()
+ end,
+ },
- { "<Esc>", nil, { exit = true } },
- },
-})
+ { "<Esc>", nil, { exit = true } },
+ },
+}