Feature Request: Leverage LSP (e.g., gopls) to inject internal function/type definitions into the LLM prompt #816
luxixing
started this conversation in
1. Feature requests
Replies: 1 comment 3 replies
-
This is a very powerful idea @luxixing, as a typescript user myself I think this would be really helpful! Maybe @kevinvandijk or @beatlevic can take a look at this to see if they think this proposal could be viable? |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Description
Hi Kilo-Code team—thank you for your continuous effort in delivering such an excellent AI coding assistant! 🙏
During day-to-day use, I noticed that when generating unit tests or refactorings for Go projects, the language model often lacks the real signatures and return types of internal packages’ functions or methods. This gap can lead to “hallucinated” code or incorrect refactors.
Below are two simplified scenarios that illustrate the issue.
Scenario 1 – Return-type mis-assumption during refactor
Both client1 and client2 are internal packages.
If Kilo-Code calls the LLM without providing the real definition of SomeFunc(), the model typically infers return types solely from variable names (result1, result2) and produces incorrect code suggestions.
Scenario 2 – Variable name ≠ actual type
Although the variable is named nodeInfo, the real return type is *cascade.NodeInfo.
Without the signature of GetNodeWithoutCache, the model often keeps propagating node-related code, resulting in compilation errors.
Proposed Solution
With this extra context, the model can produce far more accurate code for unit-test scaffolds, API docs, and refactor suggestions, reducing manual review and fixes.
Implementation Sketch (for discussion)
Expected Benefits
Lower hallucination rate: Real signatures beat guesswork based on variable names.
Higher refactor accuracy: Generated replacements are closer to “compiles-out-of-the-box.”
Better unit-test generation: Correct mocks/stubs are produced automatically.
Cross-language scalability: Works wherever an LSP is available.
Closing
If the proposal sounds viable, I’m happy to help with a PoC or PR—especially around integrating gopls or VS Code APIs.
Thanks again for your hard work, and looking forward to your feedback!
Best regards
Beta Was this translation helpful? Give feedback.
All reactions