getcursor / cursor

The AI-powered code editor
https://cursor.sh
20.58k stars 1.38k forks source link

Shortkey to exclude previous @ references from prompt context #1414

Open duotangx opened 2 months ago

duotangx commented 2 months ago

Is your feature request related to a problem? Please describe. Cursor offers shortkeys for quickly adjusting the context of a given chat message/response (eg., 'ctrl + Enter' includes the entire codebase in the response whereas 'Enter' includes only the current open file + existing chat history.

If a user has used an @ reference (eg., @Docs) at some point in the chat history there is no way to avoid re-prompting the chat model with the full reference. For example, if an @Docs has been referenced at any point in the chat history, all future contexts will always include the full @Docs tokens in the context (regardless of if one uses 'ctrl + Enter' or simply 'Enter').

This wastes tokens, since the code snippets the chat model generates based on the initial @ reference oftentimes provide sufficient context on their own for future chat responses (ie., there is no need to repeatedly re-prompt the model will the full @ reference in all future completions).

Describe the solution you'd like Like the 'ctrl + Enter' vs. 'Enter' shortkeys, there should be a shortkey to use only the existing responses outputted by the chat model and ignore any previously attached @ references. For example, if the first prompt includes an @ reference to a Doc or file and the chat model has already outputted a series of code snippets based on this reference, the user should then be able to use a shortkey such as 'ctrl + Shift + Enter' on their next prompt to include only the current open file and chat history in the prompt context rather than the entire @Docs or @File reference, thus saving input tokens.