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.
interface Example { fn example(self, name: string) -> string } fn example_call(ex: Example) -> string { ex. }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
I’ll first inspect the repository structure and locate the LSP completion implementation and its tests, then reproduce the interface-specific omission before changing the narrowest relevant code.
- Assistant
The project is a Rust workspace with dedicated LSP integration tests. I’ll search for completion handlers, member lookup logic, and existing completion test fixtures to identify where concrete types and interfaces diverge.
- Assistant
ripgrepis unavailable in the environment, so I’ll use recursivegrepand open the completion source plus relevant test sections directly. - Assistant
The likely defect is visible: instance completions only add struct fields plus separately-defined methods discovered by qualified name. Interface methods are probably stored directly inside
DefinitionBody::Interface, so they never enter either path. I’ll confirm the AST shape and semantic definition representation, then inspect visibility/method conventions to implement this consistently. - Assistant
I’ll inspect the exact interface/member structures and registration code. This will determine whether completions should read method names/types from the interface definition directly, and whether parent-interface methods need recursive inclusion.
- Assistant
Interface methods are indeed stored both in
Interface.methodsand as qualified value definitions, but registration strips the receiver from the qualified method’s function type. Consequentlyis_instance_methodrejects them. Also,Definition::is_type_definition()excludes interfaces, which may affect type-level detection but not the reported parameter case. I’ll reproduce using the existing LSP harness exactly atex.and inspect current labels, then decide whether direct interface-method enumeration is the robust fix (including inherited interfaces). - Assistant
To reproduce without modifying or adding repository tests, I’ll create a temporary external Rust test crate under
/tmpthat reuses the repository’s LSP test harness and depends on the local LSP crate. It will submit the exact issue source and print/assert completion labels. - Assistant
The external test reproduces the issue exactly: completion returns
[]. The root cause is confirmed as receiver-stripped interface signatures being filtered by concrete-method detection.I’ll add interface methods directly from
DefinitionBody::Interface, recursively including embedded parent interfaces (the valid member set of a child interface), deduplicating overridden/diamond-inherited names and guarding cycles. Existing qualified-method scanning will remain for concrete implementations. I’ll also verify whether interface type definitions should be included inis_type_definition; that appears to be an independent omission relevant to completion after a type name, but the reported instance path does not require changing it. - Assistant
I’ll examine the semantic interface traversal to match its cycle and parent-name behavior, and inspect
type_namebefore editing. - Assistant
The semantic checker already recursively collects interface methods by
parent.get_qualified_id()with a visited set. I’ll mirror that behavior in completion, usingstd::collections::HashSetto avoid adding dependencies. Method detail will use the stored interface signature (the callable signature with receiver removed), and duplicate labels will be suppressed against any subsequently scanned definitions. - Assistant
The LSP crate compiles with the change. I’ll rerun the exact external reproducer now; then I’ll extend that temporary (non-repository) test only to cover inherited interface methods and a stdlib interface, ensuring both parts of the issue and recursion work end-to-end.
- Assistant
The exact issue now passes and returns
["example"]. For edge coverage, I’ll identify a readily available prelude or Go stdlib interface and the interface embedding syntax, then run temporary end-to-end cases. - Assistant
The standalone test harness loads the prelude, whose
errorinterface provides a direct stdlib case. I’ll run two temporary tests:errorcompletion, and child-interface completion containing both own and inherited methods. - Assistant
All temporary edge cases pass: user-defined direct method, inherited method set, and prelude
error.Error. I’ll now run the repository’s existing LSP completion tests (without modifying tests), followed by formatting and lint checks. This validates that concrete structs, enums, collection methods, cross-module completion, and malformed-code resilience remain intact. - Assistant
The 48 existing completion-focused LSP tests pass, formatting is clean, and Clippy reports no warnings. I’ll perform a final repository diff/status review and run the full LSP integration test binary to catch any indirect behavior changes before submission.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.