Skip to content
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

Show method parameters as completion details #1294

Merged
merged 1 commit into from
Jan 11, 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
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
Loading