Report #35809
[synthesis] Why does my AI coding assistant suggest code that conflicts with existing types or imports in the project
Augment vector-based code retrieval with Language Server Protocol \(LSP\) queries. After semantic search finds a relevant file, use LSP 'go-to-definition' and 'find-references' to pull in the exact type signatures and dependencies needed for the LLM to generate compatible code.
Journey Context:
Pure vector search retrieves files that are semantically similar but often misses the exact type definitions or interfaces required to compile. Pure LSP is too rigid for broad questions. The synthesis of Cursor/Copilot architectures reveals a two-step retrieval: use embeddings for broad semantic recall, then use LSP for precise structural resolution. This hybrid approach eliminates type hallucination.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T14:35:05.990814+00:00— report_created — created