Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/ruby_lsp/ruby_lsp_rspec/addon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,11 @@ def resolve_test_commands(items)
elsif tags.include?("test_group")
start_line = item.dig(:range, :start, :line)
commands << "#{@rspec_command} -r #{FORMATTER_PATH} -f #{FORMATTER_NAME} #{path}:#{start_line + 1}"
else
elsif tags.include?("test_case")
full_files << "#{path}:#{item.dig(:range, :start, :line) + 1}"
else
# whole project
full_files << path
end

queue.concat(children)
Expand Down
28 changes: 28 additions & 0 deletions spec/addon_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,33 @@
])
end
end

it "resolves commands for the whole project" do
project_uri = "file:///test-project"
with_server do |server|
server.process_message(
{
id: 1,
method: "rubyLsp/resolveTestCommands",
params: {
items: [
{
id: project_uri,
label: "test-project",
tags: ["framework:rspec"],
uri: project_uri,
children: [],
},
],
},
},
)

response = pop_result(server).response
expect(response[:commands]).to eq([
"bundle exec rspec -r #{formatter_absolute_path} -f #{formatter_name} /test-project",
])
end
end
end
end