From 65058decc0350fc3bb2651fc874890bd2ddb4a30 Mon Sep 17 00:00:00 2001 From: Andy Waite <13400+andyw8@users.noreply.github.com> Date: Thu, 12 Dec 2024 11:46:23 -0500 Subject: [PATCH] Add glyph for 'Run' code lenses --- lib/ruby_lsp/ruby_lsp_rails/code_lens.rb | 6 +++--- test/ruby_lsp_rails/code_lens_test.rb | 18 +++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/ruby_lsp/ruby_lsp_rails/code_lens.rb b/lib/ruby_lsp/ruby_lsp_rails/code_lens.rb index 3a7371b0..89599dee 100644 --- a/lib/ruby_lsp/ruby_lsp_rails/code_lens.rb +++ b/lib/ruby_lsp/ruby_lsp_rails/code_lens.rb @@ -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" }, @@ -283,7 +283,7 @@ 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 }, @@ -291,7 +291,7 @@ def add_test_code_lens(node, name:, command:, kind:) @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 }, diff --git a/test/ruby_lsp_rails/code_lens_test.rb b/test/ruby_lsp_rails/code_lens_test.rb index 30a769d2..98fcc835 100644 --- a/test/ruby_lsp_rails/code_lens_test.rb +++ b/test/ruby_lsp_rails/code_lens_test.rb @@ -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 @@ -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 @@ -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 @@ -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 @@ -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