-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
💡 Description
Currently, when using the Tabby IntelliJ plugin, the quality of completions in the chat or inline suggestions can drop significantly if not all related files are manually added to the chat context.
For example:
- I'm editing
A.java, which callsfoo()fromB.java. - The method
foo()returns aCclass defined inC.java. - If I only add
A.javato the chat, Tabby often hallucinates — such as callingfoo()with wrong parameters, or accessing non-existent properties inC.
To avoid this, I have to manually click “Add file to chat” for B.java and C.java.
However, this process is manual and error-prone, especially in large projects where dependencies are not obvious.
🧱 Real-world Use Case
In our Java project, a typical service or logic file depends on multiple model, utility, and helper classes across different packages.
When writing or modifying a method, I often need related files (e.g., Entity, Mapper, DTO) to be included in context for Tabby to generate correct suggestions.
Manually adding all these files to the chat is not practical in a large-scale enterprise project with hundreds of interdependent files.
🚀 Feature Proposal
Add an “auto context expansion” or “smart add related files” mechanism in the IntelliJ plugin (or Tabby server) that automatically includes related files based on usage or imports.
Possible Strategies:
-
Static analysis
Parseimportstatements and symbol references in the current file, and automatically include referenced files or classes in the chat context. -
Dependency depth control
Allow user configuration like:autoContext: enabled: true maxDepth: 2 includeTests: false
So the plugin only pulls in files up to a certain depth.
-
Interactive confirmation
Optionally show a prompt:"Detected dependencies: B.java, C.java — include them in context?"
🧠 Expected Benefits
- Reduce hallucinations caused by missing context.
- Improve completion accuracy for cross-file references.
- Enhance developer experience and reduce manual steps.
📝 Additional Notes
Some LSP-based tools (e.g., Cursor, Continue.dev) already implement “auto include related files” via static dependency scanning or background indexing.
A similar mechanism would make Tabby’s completions much more context-aware without requiring users to manually add files.