You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Provide an API endpoint that accepts a fully qualified class name as input and returns the source code content of the class definition. This will be used to support AI tools or resource calls.
#3437
Feature Request: Enhance AI Context with Source Code from External JAR Dependencies
Summary
Provide a mechanism to fetch and optionally include the source code of classes from external JAR dependencies (based on their Fully Qualified Name) into the AI model's context, similar to vscode "Go To Type Definition" functionality.
Background & Motivation
I've been using Cursor extensively for Java development recently, and I'm impressed with its speed and the general quality of the generated code, especially for code within my project's source tree.
However, I've encountered a significant limitation when the code involves classes residing in external JAR libraries rather than the project's own source files. In these cases, Cursor often seems unable to find the corresponding class definitions to feed into the AI model's context.
As a result, the quality of the generated code that interacts with these external classes can be poor. The model lacks the necessary understanding of the external class's structure, methods, and fields, leading to inaccurate or incomplete suggestions.
Proposed Solution
I propose introducing a feature that allows Cursor to retrieve the source code definition of a class located in a JAR dependency, using its Fully Qualified Name (FQN). This functionality would be analogous to the Go To Definition (or Go To Type Definition) command commonly found in IDEs like VS Code or IntelliJ IDEA.
Crucially, there should be control over when this fetched source code is included in the AI's context:
User-Controlled: The user could explicitly trigger the lookup and inclusion of a specific external class's source code into the context for a particular query or session.
AI-Controlled (Optional): Perhaps the AI model itself could identify when it needs the definition of an external class and request/fetch it automatically (with appropriate safeguards or user confirmation prompts).
Implementing this would significantly mitigate the issue of the AI model not having access to the necessary source files when dealing with library code, thereby improving the quality and relevance of its output.
Potential Benefits
Improved Code Generation Quality: AI suggestions and generated code involving external libraries would be much more accurate and useful.
Enhanced Contextual Understanding: The AI would have a deeper understanding of the project's dependencies.
More Efficient Workflow: Reduces the need for manual workarounds when interacting with library classes.
Potential Concerns
I recognize that implementing this feature might raise potential security and licensing considerations. Accessing and potentially transmitting source code from third-party libraries could have implications depending on the libraries' licenses and the nature of the source code itself.
Request for Feedback
I would greatly appreciate hearing the development team's thoughts on the feasibility of this proposal, potential implementation strategies, and any perspectives on addressing the associated security/licensing concerns.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Feature Request: Enhance AI Context with Source Code from External JAR Dependencies
Summary
Provide a mechanism to fetch and optionally include the source code of classes from external JAR dependencies (based on their Fully Qualified Name) into the AI model's context, similar to vscode "Go To Type Definition" functionality.
Background & Motivation
I've been using Cursor extensively for Java development recently, and I'm impressed with its speed and the general quality of the generated code, especially for code within my project's source tree.
However, I've encountered a significant limitation when the code involves classes residing in external JAR libraries rather than the project's own source files. In these cases, Cursor often seems unable to find the corresponding class definitions to feed into the AI model's context.
As a result, the quality of the generated code that interacts with these external classes can be poor. The model lacks the necessary understanding of the external class's structure, methods, and fields, leading to inaccurate or incomplete suggestions.
Proposed Solution
I propose introducing a feature that allows Cursor to retrieve the source code definition of a class located in a JAR dependency, using its Fully Qualified Name (FQN). This functionality would be analogous to the
Go To Definition
(orGo To Type Definition
) command commonly found in IDEs like VS Code or IntelliJ IDEA.Crucially, there should be control over when this fetched source code is included in the AI's context:
Implementing this would significantly mitigate the issue of the AI model not having access to the necessary source files when dealing with library code, thereby improving the quality and relevance of its output.
Potential Benefits
Potential Concerns
I recognize that implementing this feature might raise potential security and licensing considerations. Accessing and potentially transmitting source code from third-party libraries could have implications depending on the libraries' licenses and the nature of the source code itself.
Request for Feedback
I would greatly appreciate hearing the development team's thoughts on the feasibility of this proposal, potential implementation strategies, and any perspectives on addressing the associated security/licensing concerns.
Thank you for considering this request!
Beta Was this translation helpful? Give feedback.
All reactions