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 interface completions by exploring the codebase.
- Assistant
Interface methods strip the
selfparameter during registration, sois_instance_methodnever matches them. I'll add interface method collection toget_instance_completionsand a test. - Assistant
Adding tests for interface completion:
- Assistant
The tests put the cursor on the dot instead of after it —
get_module_prefixonly triggers when the cursor is past the.. - Assistant
Fixed. Interface method completions were missing because of how interface methods are stored.
Root cause:
get_instance_completionsonly looked up methods viais_instance_method, which checks whether the first parameter type matches the receiver. Interface methods have theirselfparameter stripped during registration (so impl/interface satisfaction can compare signatures without receivers), so they never passed that check.Fix: Added
collect_interface_method_completionsincrates/lsp/src/completion.rsthat reads methods directly fromDefinitionBody::Interface, including inherited methods from embedded parent interfaces (impl Parent).This covers:
- User-defined interfaces with bare
self(your example) - Embedded parent interfaces
- Stdlib interfaces like
prelude.error(Error())
fn collect_interface_method_completions( type_id: &str, snapshot: &AnalysisSnapshot, same_module: bool, items: &mut Vec<CompletionItem>, seen: &mut HashSet<String>, ) { let Some(definition) = snapshot.definitions().get(type_id) else { return; }; let DefinitionBody::Interface { definition: iface } = &definition.body else { return; }; // ... collects methods and recurses into parent interfaces } - User-defined interfaces with bare
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.