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.
codeinterface 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 where that path breaks.
- Assistant
Implementing interface method completions in
get_instance_completions— interface methods are stored without aselfparameter, so the existingis_instance_methodcheck misses them. - Assistant
Now I'll add a test for interface completion.
- Assistant
The issue was in
get_instance_completions: it only handled struct fields and instance methods whose first parameter matched the receiver type. Interface methods don't fit that model — bareselfreceivers are stripped from their signatures during registration, and stdlib interfaces likeerrormay have no receiver at all.Fix: Added
collect_interface_method_completions, which reads methods from the interface definition (including embedded parent interfaces) and merges them into dot-access completions.192:236:crates/lsp/src/completion.rsfn collect_interface_method_completions( items: &mut Vec<CompletionItem>, type_id: &str, snapshot: &AnalysisSnapshot, same_module: bool, visited: &mut rustc_hash::FxHashSet<String>, ) { // ... walks Interface.methods and parent interfaces }For your example,
ex.now suggestsexample. The same path covers stdlib interfaces likeerror(suggestingError).Added 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.