Skip to content

Commit

Permalink
Show method parameters as completion details
Browse files Browse the repository at this point in the history
  • Loading branch information
vinistock committed Jan 10, 2024
1 parent a68fceb commit 92d4c30
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/ruby_lsp/requests/completion.rb
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ def build_method_completion(entry, node)
text_edit: Interface::TextEdit.new(range: range_from_node(node), new_text: name),
kind: Constant::CompletionItemKind::METHOD,
label_details: Interface::CompletionItemLabelDetails.new(
detail: "(#{entry.parameters.map(&:decorated_name).join(", ")})",
description: entry.file_name,
),
documentation: markdown_from_index_entries(name, entry),
Expand Down
1 change: 1 addition & 0 deletions test/requests/completion_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,7 @@ def process
assert_equal(["bar", "baz"], result.map(&:label))
assert_equal(["bar", "baz"], result.map(&:filter_text))
assert_equal(["bar", "baz"], result.map { |completion| completion.text_edit.new_text })
assert_equal(["(a, b)", "(c, d)"], result.map { |completion| completion.label_details.detail })
end

def test_completion_for_methods_named_with_uppercase_characters
Expand Down

0 comments on commit 92d4c30

Please sign in to comment.