Skip to content

Commit

Permalink
Merge pull request #21 from suketa/rspec_file_line
Browse files Browse the repository at this point in the history
add rspec file:line
  • Loading branch information
suketa authored Jul 19, 2022
2 parents 3e78396 + 2b76fdb commit bb2ce37
Showing 1 changed file with 26 additions and 3 deletions.
29 changes: 26 additions & 3 deletions lua/dap-ruby.lua
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,18 @@ local function setup_ruby_adapter(dap)
local pid_or_err
local waiting = config.waiting or 500
local args
local script

if config.current_line then
script = config.script .. ':' .. vim.fn.line(".")
else
script = config.script
end

if config.bundle == 'bundle' then
args = {"-n", "--open", "--port", config.port, "-c", "--", "bundle", "exec", config.command, config.script}
args = {"-n", "--open", "--port", config.port, "-c", "--", "bundle", "exec", config.command, script}
else
args = {"--open", "--port", config.port, "-c", "--", config.command, config.script}
args = {"--open", "--port", config.port, "-c", "--", config.command, script}
end

local opts = {
Expand Down Expand Up @@ -125,7 +132,22 @@ local function setup_ruby_configuration(dap)
},
{
type = 'ruby';
name = 'run current spec file';
name = 'run rspec current_file';
bundle = 'bundle';
request = 'attach';
command = "rspec";
script = "${file}";
port = 38698;
server = '127.0.0.1';
options = {
source_filetype = 'ruby';
};
localfs = true;
waiting = 1000;
},
{
type = 'ruby';
name = 'run rspec current_file:current_line';
bundle = 'bundle';
request = 'attach';
command = "rspec";
Expand All @@ -137,6 +159,7 @@ local function setup_ruby_configuration(dap)
};
localfs = true;
waiting = 1000;
current_line = true;
},
{
type = 'ruby';
Expand Down

0 comments on commit bb2ce37

Please sign in to comment.