LSP doesn't provide completion for interfaces Lisette version: 0.2.11 IDE: VSCode and…
- User
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. }Interface
No new interfaces are introduced.
- Assistant
I'll investigate how the Lisette LSP handles completions for interfaces and trace why they're missing for both stdlib and user-defined types.
- Assistant
Interface methods are registered without a
selfparameter, sois_instance_methodfilters them out. I'll add interface method completion and a test. - Assistant
Updating
get_instance_completionsto include interface methods and fixing visibility for embedded parent interfaces. - Assistant
Fixing bugs in my edit: removing the invalid
?operator and restoring correct visibility checks. - Assistant
Now I'll add a test and run the LSP completion tests.
- Assistant
Both tests pass. Running the full LSP test suite and checking for lints.
- Assistant
Root cause
Interface methods are stored on the
DefinitionBody::Interfacedefinition, and also registered asValuedefinitions — but with theselfreceiver stripped from their type signature (seecrates/semantics/src/checker/registration/methods.rs).get_instance_completionsonly picked up methods whereis_instance_method()matched, which requires the first parameter type to equal the receiver type. That works for structimplmethods, but always fails for interface methods because they have no receiver parameter in their stored signature.Fix
Added
push_interface_methods()incompletion.rsto collect methods directly from the interface definition (including embedded parent interfaces), and wired it intoget_instance_completions. Also changed that function to takemodule_idinstead of asame_modulebool so visibility is checked correctly for embedded interfaces from other modules (e.g.prelude.error).Tests
completion_on_interface_parameter_dot_access— user-defined interface
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.