Skip to content

Commit a24b469

Browse files
committed
wip
1 parent 73873fd commit a24b469

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/ruby_lsp/ruby_lsp_rails/code_lens.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,15 @@ def on_command(node)
4747
message_value = node.message.value
4848
if message_value == "test" && node.arguments.parts.any?
4949
first_argument = node.arguments.parts.first
50-
method_name = first_argument.parts.first.value if first_argument.is_a?(SyntaxTree::StringLiteral)
50+
return unless first_argument.is_a?(SyntaxTree::StringLiteral)
51+
52+
test_name = first_argument.parts.first.value
5153
test_file_path = Pathname.new(@path).relative_path_from(RailsClient.instance.root).to_s
5254
line_number = node.location.start_line
5355
command = "#{BASE_COMMAND} #{test_file_path}:#{line_number}"
5456

55-
if method_name
56-
add_code_lens(node, name: method_name, command: command)
57+
if test_name
58+
add_code_lens(node, name: test_name, command: command)
5759
end
5860
end
5961
end

0 commit comments

Comments
 (0)