ISSUE DESCRIPTION LSP doesn't provide completion for interfaces Lisette version: 0.2.11…
- User
ISSUE DESCRIPTION
LSP doesn't provide completion for interfaces Lisette version: 0.2.11 IDE: VSCode and Zed
The LSP isn't providing completions for interfaces from either stdlib or user-defined.
codeinterface Example { fn example(self, name: string) -> string } fn example_call(ex: Example) -> string { ex. }Interface
No new interfaces are introduced.
ADDITIONAL ADVICE
Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use
git checkout <file>to restore the file to its original state. You can also reset all changes in the repository usinggit reset --hardcommand. Additionally, you can usegit stashandgit stash popto temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you callsubmit) usinggit statusorgit diffcommands. However you don't need to usegit addorgit commitbefore submitting your changes. In fact,submitonly submits currently unstaged changes because it usesgit diffto get the changes that need to be submitted.CHECKLIST
Before submitting your solution, please go over the following checklist and make sure you've done everything:
- If an error was reported in the issue description, I have successfully reproduced it.
- If an error was reported in the issue description, I have confirmed that my fix resolves the error.
- I have thought about edge cases and made sure my fix handles them as well.
- I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.
Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!
(Current directory: /lisette, current file: none) bash-$
Assistant
Let me start by exploring the repository structure to understand the codebase.
Assistant
Let me start by exploring the repository structure.
Assistant
This is a Rust project (Lisette). Let me explore the crate structure.
Assistant
Let me look at how the completion is triggered and the types module.
Assistant
Now let me look at how completion is invoked. Let me look at the lib.rs to see how completion is called, and how
detect_dot_contextandget_instance_completions/get_type_completionsare used.Assistant
Now let me understand how interface types are represented in the type system.
Assistant
Interesting!
is_type_definition()does NOT includeDefinitionBody::Interface. Let me look at how the definitions map is built and whether interfaces are stored there.Assistant
Let me look at how interface methods are registered.
Assistant
Let me look at how interface types are represented in the Type enum.
Assistant
Let me look at how interface method types are constructed, especially the
selfparameter.Assistant
Let me check how interface methods are parsed and whether interfaces support static methods.
Assistant
Let me look at the part above to see how interface methods (Function) are parsed.
Assistant
Let me look at
parse_interface_methodto see if it always has self.Assistant
Let me look at how impl block methods are registered (for structs) to understand the contrast.
Assistant
Let me look at the existing tests for completion to understand the testing approach.
Assistant
Let me look at the
completionandcompletion_labelshelpers in the harness.Assistant
Let me check the Cargo.toml to understand how to run tests and the test setup.
Assistant
Let me look at the tests/Cargo.toml to understand the test binary setup.
Assistant
Let me create a temporary test to reproduce the issue. First, let me add a temp test file and a Cargo.toml entry.
Assistant
I've reproduced the bug. The labels are empty. Now let me investigate how interface methods are stored and whether they can be static. Let me look at the Interface struct's methods and the satisfaction checker.
Assistant
Let me check whether interfaces support static methods. Let me look at the docs and any tests.
Assistant
All interface methods have
self. Let me check if there's a validation requiringselfin interface methods.Assistant
Let me look at the satisfaction checker to understand how interface methods are matched against impl methods.
Assistant
Let me check if there are any tests with static (non-self) methods in interfaces.
Assistant
Let me check the empty interface test and if there are non-self interface methods. Let me look at line 1463.
Assistant
Let me look at how
selfparameter types are extracted in function signatures.Assistant
Let me look at how interface methods are emitted and whether static interface methods are supported.
Assistant
Let me look at
check_interface_embeddingand how parent interface methods are handled.Assistant
Let me check if the prelude/stdlib has interfaces.
Assistant
Let me look at a stdlib interface definition to understand the structure.
Assistant
I've reproduced the bug. Note that Go-interop interfaces have methods without
selftoo. Let me add temporary debug output to understand the flow.Assistant
Let me add temporary debug output to understand the flow.
Assistant
The build failed because
memberis being debug-printed butmemberis a String or similar. Let me check the error.Assistant
memberis destructured inside theletpattern. Themembervariable is available. Let me check - the issue is the eprintln is inside theif !member.is_empty()block, somembershould be in scope. Let me check the exact location.Actually the eprintln at line 150 is inside the
if !member.is_empty()block. Let me look.Assistant
The debug was placed in the
elsebranch wherememberisn't bound. Let me remove that and keep the useful one.Assistant
The
detect_dot_contextreturned None before reaching the type check. Let me add more debug to see what's happening.Assistant
I used
e.kind_name()- let me check ifExpressionhas that method.Assistant
Let me simplify the debug to avoid API issues.
Assistant
Now I see:
member="}"(parser artifact) and the flow goes through the member-not-empty branch. Let me add debug toget_instance_completionsto confirm it's reached and with what type_id.Assistant
Confirmed the root cause:
is_instance_methodreturnsfalsefor the interface method_entry_.Example.examplebecause the receiver is stripped. Let me revert the debug changes.Assistant
The fix is clear. Let me check the available methods on
Typefor getting qualified names of parent interfaces.Assistant
Let me check the lsp crate's dependencies for
rustc-hash.Assistant
rustc-hashis available. Let me look at the imports and current state of completion.rs.Assistant
Now let me implement the fix. Let me view the exact
get_instance_completionsfunction to edit it.Assistant
Now I'll implement the fix. Let me edit the
get_instance_completionsfunction to handle interfaces and add a recursive helper for collecting interface methods (including inherited ones).Assistant
Now let me verify the edit and build:
Assistant
It builds. Now let me run the reproduction test:
Assistant
The fix works. Let me extend my temp test to cover more edge cases: inherited methods (embedding), Go-interop interfaces, and visibility.
Assistant
Let me look at the Go-interop
io.Readerinterface definition and how to use it.Assistant
Let me find a Go-interop interface that embeds parent interfaces (uses
implinside).Assistant
The stdlib Go interfaces don't use embedding (they redeclare methods). Let me check
strings.d.lisor others for embedding. Actually, the Lisette-generated typedefs might not use embedding. Let me check thenet/httporio/fsfor embedded interfaces.Actually, let me check if there's any
implinside an interface in the stdlib typedefs.Assistant
No embedding in stdlib. Let me write a comprehensive temp test covering: user-defined interface with
self, embedded parent interfaces (inherited methods), and a Go-interop interface (methods withoutself).Assistant
I miscounted the line for the inherited test —
rw.is on line 10, not 7. Let me fix the position.Assistant
All three cases pass. Now let me run the existing LSP test suite to make sure I haven't broken anything.
Assistant
All 469 LSP tests pass. Let me test a few more edge cases: cross-module interface visibility and an empty interface. Let me look at how multi-module tests are set up.
Assistant
Let me add cross-module and empty-interface edge case tests to the temp test.
Assistant
Let me fix the URL helper to use the proper
Urltype like the existing tests.Assistant
All edge cases pass. Let me check for any compiler warnings on the lsp crate and run a broader build check.
Assistant
No warnings. Let me run clippy on the lsp crate to ensure code quality lints pass.
Assistant
Clippy passes. Now let me clean up the temporary test file and Cargo.toml entry.
Assistant
Only
crates/lsp/src/completion.rsis modified. Let me review the final diff.Assistant
The diff is clean. Let me re-run the LSP test suite once more to confirm the final state has no regressions.
Assistant
All 469 LSP tests pass. Let me do a final review of the complete modified section.
Assistant
The implementation looks correct and complete. Let me check the CHANGELOG to see if it's conventional to add an entry.
Assistant
The CHANGELOG is auto-generated from PRs, so I'll leave it. Let me verify the final repository state is clean (no leftover temp files).
Assistant
The repository is clean — only
crates/lsp/src/completion.rsis modified. Let me do one final reproduction run with a clean temp test to confirm the fix works in the final state.Assistant
The fix works in the final state. Let me confirm the repository is clean.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.