diff options
| author | Elvis Claros Castro <elvis@claros.ar> | 2024-07-12 11:18:14 -0300 |
|---|---|---|
| committer | Elvis Claros Castro <elvis@claros.ar> | 2024-07-12 11:18:14 -0300 |
| commit | ea0f4bf8ffade657b1d45152dbc183d4679e75c4 (patch) | |
| tree | cc1fb023bc308e019ddce33a4b0aed39f56805dc /lua/pi/dap/configs | |
| parent | 1fd0af14d592d612c2aaab7717c04c8806ba3daa (diff) | |
| download | nvim-conf-ea0f4bf8ffade657b1d45152dbc183d4679e75c4.tar.gz nvim-conf-ea0f4bf8ffade657b1d45152dbc183d4679e75c4.zip | |
Feat: PI
Diffstat (limited to 'lua/pi/dap/configs')
| -rw-r--r-- | lua/pi/dap/configs/dart.lua | 32 | ||||
| -rw-r--r-- | lua/pi/dap/configs/elixir.lua | 52 | ||||
| -rw-r--r-- | lua/pi/dap/configs/golang.lua | 1 | ||||
| -rw-r--r-- | lua/pi/dap/configs/javascript.lua | 62 | ||||
| -rw-r--r-- | lua/pi/dap/configs/kotlin.lua | 18 | ||||
| -rw-r--r-- | lua/pi/dap/configs/php.lua | 27 | ||||
| -rw-r--r-- | lua/pi/dap/configs/rust.lua | 57 |
7 files changed, 249 insertions, 0 deletions
diff --git a/lua/pi/dap/configs/dart.lua b/lua/pi/dap/configs/dart.lua new file mode 100644 index 0000000..a23c118 --- /dev/null +++ b/lua/pi/dap/configs/dart.lua @@ -0,0 +1,32 @@ +local dap = require('dap') + +dap.adapters.dart = { + type = "executable", + -- As of this writing, this functionality is open for review in https://github.com/flutter/flutter/pull/91802 + command = "flutter", + args = {"debug_adapter"} +} +dap.configurations.dart = { + { + name = "Launch Flutter Program Linux", + type = "dart", + request = "launch", + -- The nvim-dap plugin populates this variable with the filename of the current buffer + program = "${file}", + -- The nvim-dap plugin populates this variable with the editor's current working directory + cwd = "${workspaceFolder}", + -- This gets forwarded to the Flutter CLI tool, substitute `linux` for whatever device you wish to launch + toolArgs = {"-d", "linux"} + }, + { + name = "Launch Flutter Program Motorola", + type = "dart", + request = "launch", + -- The nvim-dap plugin populates this variable with the filename of the current buffer + program = "${file}", + -- The nvim-dap plugin populates this variable with the editor's current working directory + cwd = "${workspaceFolder}", + -- This gets forwarded to the Flutter CLI tool, substitute `linux` for whatever device you wish to launch + toolArgs = {"-d", "192.168.0.33:5555"} + } +} diff --git a/lua/pi/dap/configs/elixir.lua b/lua/pi/dap/configs/elixir.lua new file mode 100644 index 0000000..bf732ce --- /dev/null +++ b/lua/pi/dap/configs/elixir.lua @@ -0,0 +1,52 @@ +local dap = require('dap') + +dap.adapters.mix_task = { + type = 'executable', + command = 'elixir-ls-debugger', -- El comando 'elixir-ls' está en $PATH + args = {} +} + +dap.configurations.elixir = { + { + type = "mix_task", + name = "mix (Default task)", + request = "launch", + projectDir = "${workspaceRoot}" + }, + { + type = "mix_task", + name = "mix test", + request = "launch", + task = 'test', + env = { + MIX_ENV = "test", + MIX_TARGET = "host", + HEX_UNSAFE_HTTPS = 1 + }, + taskArgs = {"--trace"}, + startApps = true, -- for Phoenix projects + projectDir = "${workspaceFolder}", + requireFiles = { + "test/**/test_helper.exs", + "test/**/*_test.exs" + } + }, + { + type = "mix_task", + name = "phx server", + request = "launch", + stackTraceMode = "all", + task = 'phx.server', + debugAutoInterpretAllModules = true, + noDebug = false, + exitAfterTaskReturns = false, + env = { + MIX_ENV = "dev", + MIX_TARGET = "host", + HEX_UNSAFE_HTTPS = 1 + }, + startApps = false, -- for Phoenix projects + taskArgs = {"--no-halt", "--open"}, + projectDir = "${workspaceFolder}", + }, +} diff --git a/lua/pi/dap/configs/golang.lua b/lua/pi/dap/configs/golang.lua new file mode 100644 index 0000000..1ec449a --- /dev/null +++ b/lua/pi/dap/configs/golang.lua @@ -0,0 +1 @@ +require("dap-go").setup() diff --git a/lua/pi/dap/configs/javascript.lua b/lua/pi/dap/configs/javascript.lua new file mode 100644 index 0000000..03173ba --- /dev/null +++ b/lua/pi/dap/configs/javascript.lua @@ -0,0 +1,62 @@ +local dap = require('dap') +dap.adapters.firefox = { + type = 'executable', + command = 'firefox-debug-adapter', +} + +dap.configurations.typescript = { + { + name = 'Debug with Firefox', + type = 'firefox', + request = 'launch', + reAttach = true, + url = 'http://localhost:3010', + webRoot = '${workspaceFolder}', + firefoxExecutable = '/home/elvis/.local/bin/firefox' + }, +} +-- 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}", +-- }, +-- } +-- 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", +-- }, +-- } +-- end diff --git a/lua/pi/dap/configs/kotlin.lua b/lua/pi/dap/configs/kotlin.lua new file mode 100644 index 0000000..aa486db --- /dev/null +++ b/lua/pi/dap/configs/kotlin.lua @@ -0,0 +1,18 @@ +local dap = require('dap') + +dap.adapters.kotlin = { + type = 'executable'; + command = "kotlin-debug-adapter"; +} + +dap.configurations.kotlin = { + { + type = 'kotlin', + request = 'launch', + program = "${file}", + name = 'Launch kotlin program', + projectRoot = "${workspaceFolder}/app", + mainClass = "AppKt", + } +} +dap.defaults.kotlin.auto_continue_if_many_stopped = false diff --git a/lua/pi/dap/configs/php.lua b/lua/pi/dap/configs/php.lua new file mode 100644 index 0000000..968bb9d --- /dev/null +++ b/lua/pi/dap/configs/php.lua @@ -0,0 +1,27 @@ +local dap = require("dap") + +dap.adapters.php = { + 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}", + }, + }, +} diff --git a/lua/pi/dap/configs/rust.lua b/lua/pi/dap/configs/rust.lua new file mode 100644 index 0000000..9ca976f --- /dev/null +++ b/lua/pi/dap/configs/rust.lua @@ -0,0 +1,57 @@ +local dap = require("dap") + +local rust_adapter = nil +local rust_adapters = { "lldb-vscode", "codelldb" } +for _, adapter in pairs(rust_adapters) do + if vim.fn.executable(adapter) then + rust_adapter = adapter + end +end + +if rust_adapter ~= nil then + dap.adapters.lldb = { + type = "executable", + command = rust_adapter, + name = "lldb", + } + + dap.configurations.rust = { + { + name = "launch", + type = "lldb", + request = "launch", + program = function() + local dir = vim.fn.getcwd() + return dir .. "/target/debug/" .. vim.fs.basename(dir) + end, + cwd = "${workspaceFolder}", + stopOnEntry = false, + args = function() + local resp = vim.fn.input "Arguments: " + if resp == "" then + return {} + end + + return vim.fn.split(resp, " ") + end, + }, + { + name = "custom", + type = "lldb", + request = "launch", + program = function() + return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file") + end, + cwd = "${workspaceFolder}", + stopOnEntry = false, + args = function() + local resp = vim.fn.input "Arguments: " + if resp == "" then + return {} + end + + return vim.fn.split(resp, " ") + end, + }, + } +end |