Skip to content

Add glyph for 'Run' code lenses #544

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 12, 2024
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
6 changes: 3 additions & 3 deletions lib/ruby_lsp/ruby_lsp_rails/code_lens.rb
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def add_migrate_code_lens(node, name:, command:)

@response_builder << create_code_lens(
node,
title: "Run",
title: "Run",
command_name: "rubyLsp.runTask",
arguments: [command],
data: { type: "migrate" },
Expand Down Expand Up @@ -283,15 +283,15 @@ def add_test_code_lens(node, name:, command:, kind:)

@response_builder << create_code_lens(
node,
title: "Run",
title: "Run",
command_name: "rubyLsp.runTest",
arguments: arguments,
data: { type: "test", **grouping_data },
)

@response_builder << create_code_lens(
node,
title: "Run In Terminal",
title: "Run In Terminal",
command_name: "rubyLsp.runTestInTerminal",
arguments: arguments,
data: { type: "test_in_terminal", **grouping_data },
Expand Down
18 changes: 9 additions & 9 deletions test/ruby_lsp_rails/code_lens_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ class Test < ActiveSupport::TestCase
# The first 3 responses are for the test class.
# The last 3 are for the test declaration.
assert_equal(6, response.size)
assert_match("Run", response[3].command.title)
assert_match("Run", response[3].command.title)
assert_match(%r{(ruby )?bin/rails test /fake\.rb:2}, response[3].command.arguments[2])
assert_match("Run In Terminal", response[4].command.title)
assert_match("Run In Terminal", response[4].command.title)
assert_match("Debug", response[5].command.title)
end

Expand All @@ -54,9 +54,9 @@ class Test < ActiveSupport::TestCase
# The first 3 responses are for the test class.
# The last 3 are for the test declaration.
assert_equal(6, response.size)
assert_match("Run", response[3].command.title)
assert_match("Run", response[3].command.title)
assert_match(%r{(ruby )?bin/rails test /fake\.rb:2}, response[3].command.arguments[2])
assert_match("Run In Terminal", response[4].command.title)
assert_match("Run In Terminal", response[4].command.title)
assert_match("Debug", response[5].command.title)
end

Expand All @@ -73,9 +73,9 @@ class Test < ActiveSupport::TestCase
# The first 3 responses are for the test class.
# The last 3 are for the test declaration.
assert_equal(6, response.size)
assert_match("Run", response[3].command.title)
assert_match("Run", response[3].command.title)
assert_match(%r{(ruby )?bin/rails test /fake\.rb:2}, response[3].command.arguments[2])
assert_match("Run In Terminal", response[4].command.title)
assert_match("Run In Terminal", response[4].command.title)
assert_match("Debug", response[5].command.title)
end

Expand Down Expand Up @@ -144,9 +144,9 @@ def test_example
# The first 3 responses are for the test declaration.
# The last 3 are for the test class.
assert_equal(6, response.size)
assert_match("Run", response[3].command.title)
assert_match("Run", response[3].command.title)
assert_match(%r{(ruby )?bin/rails test /fake\.rb:2}, response[3].command.arguments[2])
assert_match("Run In Terminal", response[4].command.title)
assert_match("Run In Terminal", response[4].command.title)
assert_match("Debug", response[5].command.title)
end

Expand Down Expand Up @@ -301,7 +301,7 @@ def change
RUBY

assert_equal(1, response.size)
assert_match("Run", response[0].command.title)
assert_match("Run", response[0].command.title)
assert_match("#{ruby} bin/rails db:migrate VERSION=123456", response[0].command.arguments[0])
end

Expand Down
Loading