continuedev / continue

⏩ Continue is the leading open-source AI code assistant. You can connect any models and any context to build custom autocomplete and chat experiences inside VS Code and JetBrains
https://docs.continue.dev/
Apache License 2.0
19.56k stars 1.7k forks source link

Context: Improvements to adding the current file as context #2694

Open Astlaan opened 1 month ago

Astlaan commented 1 month ago

Validations

Problem

No response

Solution

My main suggestion is: 1) Add a visual hint for adding the current file as context via Alt+Enter, similarly as is already displayed in the Chat for adding the whole Codebase context with Ctrl+Enter

Bonus suggestion: 2) Maybe it could be cool as well to add a shortcut to add the current file as context without executing the chat right away, as suggested here for Cursor: https://forum.cursor.com/t/key-map-to-add-current-file-as-context/14211/6

Patrick-Erichsen commented 1 month ago

Regarding your first suggestion... We do have this! Press the "option" key and you should see the "use codebase" text toggle to "use active file".

We just realized yesterday that this isn't documented in the keyboard shortcuts in the "more" page. Thanks for the reminder to get that updated 🙂

Astlaan commented 1 month ago

Regarding your first suggestion... We do have this! Press the "option" key and you should see the "use codebase" text toggle to "use active file".

We just realized yesterday that this isn't documented in the keyboard shortcuts in the "more" page. Thanks for the reminder to get that updated 🙂

@Patrick-Erichsen Ah, indeed I just saw this ahah. But I think this is only helpful if someone already is familiar with the command. Was my case yesterday, I wasn't aware of it and ended up asking on Discord.

I would instead change to something more similar to Cursor's UI: image

Though calling it "with current file" instead of "with context"

Patrick-Erichsen commented 1 month ago

100% agree on the "if someone is already familiar" part. I often forget myself that it's available 😅

Would you mind sharing what width your sidebar was in that screenshot, or in general, what width you keep it at? Or just roughly what % of your screen width you use for Chat if you're not sure how to get the exact width.

I think if we were to do something like this, we'd only display the extra "with current file" option above a certain viewport width. We already do that with a few items, e.g. if your on too small of a screen we don't display the "use codebase" option.

RomneyDa commented 1 month ago

There is also the "currentFile" context provider which can be added in config as with "name": "currentFile" and no params and used like @currentFile

Astlaan commented 3 weeks ago

@Patrick-Erichsen In general I think my VS Code would look like this.

image

It seems the way cursor deals with this is just to hide the extra hints when the sidebar's size is reduced

Stampede commented 2 days ago

Regarding your first suggestion... We do have this! Press the "option" key and you should see the "use codebase" text toggle to "use active file".

We just realized yesterday that this isn't documented in the keyboard shortcuts in the "more" page. Thanks for the reminder to get that updated 🙂

I do not have an option key on my keyboard, and your documentation says to use "cmd/ctrl + opt + enter," which is something different than what you wrote above. So this is very confusing. I'm not sure if that's something worth submitting an issue for.

But thanks to your post, I tried pressing the "Alt" key while in the chat window and I think that will submit the current file as context.

Thanks for your post, though as I have been struggling to figure this out for much too long!

Patrick-Erichsen commented 5 hours ago

Apologies for the confusion @Stampede - just updated the docs to specify the "Alt" key for Windows

https://github.com/continuedev/continue/pull/3107