Skip to content

Provide completion for expressions inside call arguments#598

Open
vinistock wants to merge 1 commit intomainfrom
02-24-provide_completion_for_expressions_inside_call_arguments
Open

Provide completion for expressions inside call arguments#598
vinistock wants to merge 1 commit intomainfrom
02-24-provide_completion_for_expressions_inside_call_arguments

Conversation

@vinistock
Copy link
Member

@vinistock vinistock commented Feb 24, 2026

This PR adds completion for expressions inside of call arguments. This is a special case of expression completion. It includes everything that you would expect from expression completion + any keyword parameters that the user may refer to.

Copy link
Member Author

vinistock commented Feb 24, 2026

@vinistock vinistock force-pushed the 02-24-simplify_completion_tests_with_assertion_macro branch from 84426e7 to 418fe63 Compare February 24, 2026 19:27
@vinistock vinistock force-pushed the 02-24-provide_completion_for_expressions_inside_call_arguments branch from aab77ce to ea08a82 Compare February 24, 2026 19:27
@vinistock vinistock force-pushed the 02-24-simplify_completion_tests_with_assertion_macro branch from 418fe63 to 8eb15f0 Compare February 24, 2026 19:29
@vinistock vinistock force-pushed the 02-24-provide_completion_for_expressions_inside_call_arguments branch from ea08a82 to 0403d9f Compare February 24, 2026 19:29
@vinistock vinistock self-assigned this Feb 24, 2026
@vinistock vinistock marked this pull request as ready for review February 24, 2026 19:39
@vinistock vinistock requested a review from a team as a code owner February 24, 2026 19:39
@vinistock vinistock force-pushed the 02-24-simplify_completion_tests_with_assertion_macro branch from 8eb15f0 to 424aa3d Compare February 24, 2026 22:03
@vinistock vinistock force-pushed the 02-24-provide_completion_for_expressions_inside_call_arguments branch from 0403d9f to 291c8f3 Compare February 24, 2026 22:03
@vinistock vinistock force-pushed the 02-24-simplify_completion_tests_with_assertion_macro branch from 424aa3d to 43c4d78 Compare February 24, 2026 22:12
@vinistock vinistock force-pushed the 02-24-provide_completion_for_expressions_inside_call_arguments branch from 291c8f3 to 19864f5 Compare February 24, 2026 22:12
@vinistock vinistock force-pushed the 02-24-simplify_completion_tests_with_assertion_macro branch from 43c4d78 to 6222da0 Compare February 25, 2026 14:37
@vinistock vinistock force-pushed the 02-24-provide_completion_for_expressions_inside_call_arguments branch 2 times, most recently from 20714f7 to 79b4481 Compare February 25, 2026 14:55
};

// Find the first Method definition to extract keyword parameters
for def_id in method_decl.definitions() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a few tests showing we only consider the "first" definitions we indexed:

def foo(a, b, c); end # we show this one
def foo(x, y); end 

Also, are sure the indexing order for the same method in different document is stable?

# file1.rb
def foo(a, b, c); end # we show this one
# file2.rb
def foo(x, y); end 

We should always pick the same. Do we need to sort the definitions() by document URI?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a test for this. We always return the same definition because the hashing of the ID is deterministic, which means that we find the same entry in the hashmap when iterating. I don't believe we need to sort.

@vinistock vinistock force-pushed the 02-24-provide_completion_for_expressions_inside_call_arguments branch from 79b4481 to 9b43f88 Compare March 2, 2026 19:25
@vinistock vinistock force-pushed the 02-24-simplify_completion_tests_with_assertion_macro branch from 4fd5c1a to adde64d Compare March 2, 2026 19:25
@graphite-app graphite-app bot changed the base branch from 02-24-simplify_completion_tests_with_assertion_macro to graphite-base/598 March 2, 2026 19:34
@vinistock vinistock force-pushed the 02-24-provide_completion_for_expressions_inside_call_arguments branch from 9b43f88 to 1d446f7 Compare March 2, 2026 19:35
@vinistock vinistock force-pushed the graphite-base/598 branch from adde64d to 7c5b733 Compare March 2, 2026 19:35
@graphite-app graphite-app bot changed the base branch from graphite-base/598 to 02-24-simplify_completion_tests_with_assertion_macro March 2, 2026 19:35
@vinistock vinistock force-pushed the 02-24-provide_completion_for_expressions_inside_call_arguments branch from 1d446f7 to ec1706f Compare March 2, 2026 19:35
@vinistock vinistock changed the base branch from 02-24-simplify_completion_tests_with_assertion_macro to graphite-base/598 March 2, 2026 19:42
@vinistock vinistock force-pushed the 02-24-provide_completion_for_expressions_inside_call_arguments branch from ec1706f to 46e0d94 Compare March 2, 2026 19:42
@graphite-app graphite-app bot changed the base branch from graphite-base/598 to main March 2, 2026 19:42
@vinistock vinistock force-pushed the 02-24-provide_completion_for_expressions_inside_call_arguments branch from 46e0d94 to 81009f6 Compare March 2, 2026 19:42
@vinistock vinistock force-pushed the 02-24-provide_completion_for_expressions_inside_call_arguments branch from 81009f6 to a03508c Compare March 2, 2026 19:51
@vinistock vinistock requested a review from Morriar March 2, 2026 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants