fix(completion): offer implicit receiver members in bare completion#203
Merged
Hessesian merged 1 commit intoJul 4, 2026
Merged
Conversation
Inside with/apply/run lambdas, bare identifier completion now includes members of the inferred receiver type, matching explicit this. completion behavior.
There was a problem hiding this comment.
Pull request overview
This PR improves Kotlin completion inside receiver lambdas (e.g., with(x) { ... }, x.apply { ... }, x.run { ... }) by inferring the implicit receiver type and merging its members into bare identifier completion (so users don’t need to type this. to see receiver members).
Changes:
- Add
ScopeContext::lambda_this_typederived fromfind_this_context_in_linesto represent the resolved implicit receiver type specifically for receiver lambdas. - Extend bare-word completion to include implicit receiver members when
ctx.receiver.is_none()(and not in annotation-only context), de-duplicating by label. - Add regression tests covering
with/apply/runbare completion, aforEachnegative case, and ensuringthis.dot completion still works.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/indexer_tests.rs |
Adds completion regression tests for implicit receiver members in bare completion, plus a negative forEach case. |
src/features/completion.rs |
Injects implicit receiver member completions into bare completion results. |
src/features/completion_context.rs |
Introduces lambda_this_type in ScopeContext and resolves it via find_this_context_in_lines. |
src/features/completion_context_tests.rs |
Updates struct literals for the new lambda_this_type field. |
Hessesian
added a commit
that referenced
this pull request
Jul 4, 2026
…resolution
Ports the contribution onto the CST-era shapes: resolve_lambda_this_type
drops the text-lines argument (CursorPos::from(position) + the 3-arg
find_this_context_in_lines), and ScopeContext::build keeps its
position-only signature.
The contributor's mid-typing tests exposed the known repair-gap asymmetry:
`with(user) { this.` (unclosed brace) parses to an ERROR tree and the
`this` path had no brace repair — only `it` did. find_this_context_in_lines
now routes through the same repair-gated tree acquisition
(LambdaResolutionDoc, renamed from ItResolutionDoc since it was never
it-specific).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EJsyQ1UgF8uJYR4HgpxEBB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem: Inside
with(x) { },x.apply { }, orx.run { }, bare identifier completion didn’t offer receiver members - onlythis.did.Fix: Infer the implicit receiver type in those lambdas and merge its members into bare completion.