2023-11-17 10:08:13 +00:00
|
|
|
--Enable (broadcasting) snippet capability for completion
|
|
|
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
|
|
|
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
|
|
|
|
|
|
|
require'lspconfig'local dap, dapui = require("dap"), require("dapui")
|
|
|
|
dap.listeners.after.event_initialized["dapui_config"] = function()
|
|
|
|
dapui.open()
|
|
|
|
end
|
|
|
|
dap.listeners.before.event_terminated["dapui_config"] = function()
|
|
|
|
dapui.close()
|
|
|
|
end
|
|
|
|
dap.listeners.before.event_exited["dapui_config"] = function()
|
|
|
|
dapui.close()
|
|
|
|
end
|
|
|
|
|
|
|
|
require("dapui").setup()
|
2024-08-14 14:04:16 +00:00
|
|
|
|
2023-11-17 10:08:13 +00:00
|
|
|
dap.adapters.ruby = function(callback, config)
|
|
|
|
callback {
|
|
|
|
type = "server",
|
|
|
|
host = "127.0.0.1",
|
2024-08-14 14:04:16 +00:00
|
|
|
port = "3030",
|
2023-11-17 10:08:13 +00:00
|
|
|
executable = {
|
|
|
|
command = "bundle",
|
2024-08-14 14:04:16 +00:00
|
|
|
args = { "exec", "rdbg", "-n", "--open", "--nonstop", "--port", "3030",
|
2023-11-17 10:08:13 +00:00
|
|
|
"-c", "--", "bundle", "exec", config.command, config.script,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
dap.configurations.ruby = {
|
2024-08-14 14:04:16 +00:00
|
|
|
{
|
|
|
|
type = "ruby",
|
|
|
|
name = "Start Rails server",
|
|
|
|
request = "attach",
|
|
|
|
localfs = true,
|
|
|
|
command = "rails s",
|
|
|
|
},
|
2023-11-17 10:08:13 +00:00
|
|
|
{
|
|
|
|
type = "ruby",
|
|
|
|
name = "debug current file",
|
|
|
|
request = "attach",
|
|
|
|
localfs = true,
|
|
|
|
command = "ruby",
|
|
|
|
script = "${file}",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type = "ruby",
|
|
|
|
name = "run current spec file",
|
|
|
|
request = "attach",
|
|
|
|
localfs = true,
|
|
|
|
command = "rspec",
|
|
|
|
script = "${file}",
|
|
|
|
},
|
|
|
|
}
|