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. }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 map the repository and locate the LSP completion/type-resolution implementation and relevant tests. Then I’ll reproduce the missing interface members, patch the general type-handling path, and run focused plus broader tests.
- Assistant
The project is a Rust workspace with dedicated LSP integration tests. I’ll inspect the LSP crate and existing completion fixtures/harness to understand both the implementation and the expected test protocol without modifying tests.
- Assistant
I found the focused completion helpers. Next I’ll read their type lookup logic alongside semantic definitions for interfaces and implementation methods; the likely defect is that member collection recognizes structs/enums/impl blocks but omits interface declarations.
- Assistant
The omission is confirmed in
get_instance_completions: it emits struct fields and separately stored concrete methods only. Interface methods live insideDefinitionBody::Interface, so they are never visited. I’ll now inspect the exact interface representation, generic substitution utilities, inheritance behavior, and how stdlib interfaces are encoded to ensure the fix supports user-defined, imported, generic, and parent-interface members rather than only the sample. - Assistant
The semantic
Store::get_all_methodsalready implements interface method collection, generic substitution, and parent traversal, but the LSP snapshot exposes only definitions and completion currently has just a string type ID (losing generic arguments). I’ll inspect snapshot/result APIs and type-name handling to choose between reusing the semantic store or adding a small safe recursive collector in LSP. - Assistant
A minimal robust fix is to recursively collect
Interface.methodsfrom the snapshot definitions, including inherited interfaces and suppressing duplicates/cycles, before the existing concrete-method scan. Interface methods are part of the public contract, so field-style module visibility filtering does not apply to individual methods. I’ll implement this incompletion.rs, retaining existing behavior and details, then format and reproduce through the real LSP integration harness using an external temporary copy of the test setup (not altering repository tests). - Assistant
The collector is implemented and formatted. Before running tests, I’ll inspect the test client’s initialization/open flow and package test configuration so I can make an exact temporary reproduction without touching tracked or test files. I’ll also compile first to catch API/type issues.
- Assistant
Compilation used the package alias rather than its actual workspace package name, so I’ll correct that. For the behavioral reproduction, I’ll create a standalone temporary Cargo project under
/tmpthat depends on this checkout’s LSP crate and reuses the public test harness protocol. This avoids any additions or edits to repository tests. I’ll first run it against the current fix, then temporarily reverse only the source patch to demonstrate the baseline failure and restore it immediately. - Assistant
The LSP crate compiles successfully. The external project did not inherit the repository’s
rust-toolchain.toml, so its Cargo invocation lacked a selected toolchain; I’ll rerun it explicitly with the installed 1.94 toolchain. - Assistant
The exact reported own-method case now succeeds (
["example"]). The additional inherited-interface assertion exposed that parent IDs in definitions can be stored unqualified (Parent) while snapshot keys are qualified (main.Parent), so the recursive lookup needs module-relative qualification. I’ll inspecttype_nameand parent registration output assumptions, then adjust parent resolution generally (same module first, already-qualified otherwise). - Assistant
type_namepreserves nominal IDs exactly, and parent annotations may remain leaf names in this path. I’ll resolve each parent by first trying its ID directly, then qualifying it with the current interface’s module prefix derived from the definition’s own name. This preserves imported/already-qualified parents while handling local inheritance. - Assistant
Own completion still passes, but my assumed inheritance syntax (
interface Example: Parent) evidently did not populate semantic parents, so this is a reproduction-fixture issue rather than lookup evidence. I’ll locate actual interface inheritance syntax in repository tests/docs and update only the external fixture. - Assistant
Actual embedding syntax is
impl Parentinside the interface body. I’ll correct the external source and rerun; this will validate recursive inherited completion and local qualification. - Assistant
Adding the embedding line shifted the completion cursor by one line, causing a global completion request. I’ll update the external cursor to the actual
ex.line and rerun. - Assistant
The fixed LSP now returns both own and inherited interface methods (
["example", "parent"]). To satisfy the explicit reproduction requirement, I’ll preserve the fixed file externally, restore the tracked file to HEAD only long enough to run the same external reproducer (which should fail with no interface methods), and then restore the fixed source regardless of the command’s exit status. - Assistant
The baseline reproduction failed exactly as reported, returning
[], and the fixed source has been restored. I’ll now extend the external runtime check to a Go stdlib interface (go:net.Conn) to verify the same collector works for stdlib definitions, then run the repository’s completion-focused LSP tests. - Assistant
Both runtime scenarios now pass: user interface own/inherited methods and stdlib
net.Connmethods (Read,Write,Close, deadlines, addresses). I’ll run all LSP tests whose names containcompletion, which covers dot completion, malformed-code resilience, imports, cross-module behavior, and existing concrete members. - Assistant
All 48 existing completion-focused integration tests pass. I’ll now review the final diff for accidental changes and run the complete LSP integration suite plus crate tests; the suite is the broadest regression check for snapshot analysis and request handling.
- Assistant
The complete 469-test LSP suite passes, as do the LSP crate tests, and the diff contains only the intended completion change. I’ll run Clippy for the affected crate and perform a final status/diff check. If clean, I’ll submit with the requested checklist accounting.
- Assistant
Final verification is clean. Checklist:
- Successfully reproduced the reported error. Using an external LSP protocol reproducer against the unmodified source, completion for
ex.whereex: Examplereturned[]and failed the method assertion. - Confirmed the fix resolves the error. The same reproducer now returns
example; it also returns inheritedparent, and stdlibnet.ConnreturnsRead,Write,Close, and its other interface methods. - Considered edge cases. The collector handles own and embedded parent interfaces, module-relative and already-qualified parent IDs, duplicate/overridden method names, and inheritance cycles. Existing struct/concrete method completion remains unchanged.
- Ran affected existing tests. All 48 completion-focused LSP tests passed; the full 469-test LSP integration suite passed; LSP crate tests passed; Clippy with warnings denied passed; formatting and are clean.
- Successfully reproduced the reported error. Using an external LSP protocol reproducer against the unmodified source, completion for
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.