Skip to content

Commit

Permalink
Add glyph for 'Run' code lenses
Browse files Browse the repository at this point in the history
  • Loading branch information
andyw8 committed Dec 12, 2024
1 parent 955dc27 commit b35fc73
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
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

0 comments on commit b35fc73

Please sign in to comment.