Skip to content

Conversation

@fbricon
Copy link
Contributor

@fbricon fbricon commented Jul 18, 2025

This PR makes it simpler to add code to the Chat context: if no code is selected, the entire line is added to the context by Cmd+I or Cmd+L. This behaviour is similar to what Github Copilot offers.

expand-empty-selection.mp4

Summary by cubic

Cmd+L and Cmd+I now select the entire line if no text is selected, making it easier to add code to the Chat context. This matches the behavior found in GitHub Copilot.

@fbricon fbricon requested a review from a team as a code owner July 18, 2025 17:12
@fbricon fbricon requested review from Patrick-Erichsen and removed request for a team July 18, 2025 17:12
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jul 18, 2025
@Patrick-Erichsen
Copy link
Collaborator

I think some of the e2e tests have a valid failure here.

But, I believe at least for cmd + i the current behavior is to insert at the cursor location rather than add the line as context. I think this would also break the ability to toggle open/close the sidebar using cmd + L.

Is your main thought here that Copilot behaves in the way you showed in that video?

cc @sestinj for a second opinion on behavior.

@Patrick-Erichsen
Copy link
Collaborator

Chatted this over with @sestinj

  • We'd like to preserve the cmd + L sidebar toggling behavior
  • We'd like to preserve cmd + I insert behavior, but only on empty lines.

With that in mind, could we scope the update to basically be "if the user pressed cmd + I on a line with any characters, the entire line is added to context` ?

@fbricon
Copy link
Contributor Author

fbricon commented Jul 28, 2025

So from what I can see, the existing Cmd+L behavior is to show the webview if hidden, and focus the cursor there. Not sure it's accurate to call it toggle, since another Cmd+L doesn't hide it, but the webview is unfocused.

I can look into reducing the scope of Cmd+I, I'll see if it works

@Patrick-Erichsen
Copy link
Collaborator

Not sure it's accurate to call it toggle, since another Cmd+L doesn't hide it, but the webview is unfocused.

Hm, this isn't working for you? For me if I repeatedly hit Cmd + L it will open/close the sidebar.

@Patrick-Erichsen
Copy link
Collaborator

I merged main but I believe the remaining failures are legitimate.

@fbricon
Copy link
Contributor Author

fbricon commented Jul 31, 2025

So actually the bulk of these changes concerns selecting the whole line on Cmd+L.

For Cmd+I, the only thing that changed was the command is now visible when right-clicking on the editor (removing the editorHasSelection clause for continue.focusEdit in package.json). The behavior of Cmd+I itself has not changed.

If the new Cmd+L behavior is not something the Continue team is willing to get in, this is fine, we can just reject this PR. But if you find some value in this approach, then I'll look more closely into the test failures, as expectations have changed.

@Patrick-Erichsen Let me know what you decide.

@fbricon
Copy link
Contributor Author

fbricon commented Jul 31, 2025

Not sure it's accurate to call it toggle, since another Cmd+L doesn't hide it, but the webview is unfocused.

Hm, this isn't working for you? For me if I repeatedly hit Cmd + L it will open/close the sidebar.

No it doesn't work for me that way. 2nd Cmd+L doesn't close the sidebar, just unfocusses it. I tried woth both release and prerelease versions of continue, on 2 macbooks.

@Patrick-Erichsen
Copy link
Collaborator

Patrick-Erichsen commented Aug 4, 2025

Hm, well the cmd + L toggle behavior not working is a bug, that is the intended behavior.

But if the cmd + I behavior remains the same and the bulk of the changes are around the cmd + L line highlight then I think we can close this out, unfortunately. I don't think we have metrics on how many people actually use the toggle behavior so it's more of a "gut feel" but at least on the team most of use the toggle behavior quite frequently.

@Patrick-Erichsen
Copy link
Collaborator

@fbricon circling back here, chatted things over more with @TyDunn and I think we'd be opening to aligning with Copilot here, eg having cmd + L add the current line.

I think it's likely that the only folks using the toggle behavior is the internal Continue team.

@fbricon
Copy link
Contributor Author

fbricon commented Aug 15, 2025

ok, I'll take a look at the test failures when I'm back from PTO on Monday

@fbricon fbricon force-pushed the empty-selection-selects-line branch from bf886bd to 96c3627 Compare August 18, 2025 11:31
@Patrick-Erichsen
Copy link
Collaborator

Think a few are still failing unfortunately

@fbricon
Copy link
Contributor Author

fbricon commented Aug 19, 2025

Yes, it was a simple rebase. I need to figure out how to run those tests locally

@fbricon fbricon force-pushed the empty-selection-selects-line branch from 96c3627 to 1696eb2 Compare August 21, 2025 14:22
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Aug 21, 2025
@RomneyDa
Copy link
Collaborator

@fbricon after sitting on this for a while we're thinking it should add the whole file, since in most cases during usage the user will want to just add the file to context, and one line is rarely useful/probably usually confusing to the model. Thoughts on tweaking to add full file instead of that line?

Agree that removing the sidebar toggle functionality is fine

@Patrick-Erichsen
Copy link
Collaborator

@fbricon bump on this one!

@fbricon
Copy link
Contributor Author

fbricon commented Aug 29, 2025

I'll get back to it on Monday

@fbricon fbricon force-pushed the empty-selection-selects-line branch 2 times, most recently from 77b0427 to 56b8bb3 Compare September 5, 2025 12:34
@fbricon fbricon changed the title feat: allow Cmd+L / Cmd+I on empty selection to select the entire line feat: allow Cmd+L / Cmd+I on empty selection to select the entire file Sep 5, 2025
@fbricon
Copy link
Contributor Author

fbricon commented Sep 5, 2025

The shortcut now selects the entire file if no text is highlighted. e2e tests fixed (that took me a while).

Looks like some other unit tests fail but they seem irrelevant

Copy link
Collaborator

@RomneyDa RomneyDa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, appreciate inclusion of e2e tests

@github-project-automation github-project-automation bot moved this from Todo to In Progress in Issues and PRs Sep 8, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Sep 8, 2025
Copy link
Collaborator

@RomneyDa RomneyDa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fbricon it looks like the description is still showing the line number of the cursor as the range, although the functionality of including the entire file is working

image

@dosubot dosubot bot removed the lgtm This PR has been approved by a maintainer label Sep 8, 2025
Signed-off-by: Fred Bricon <fbricon@gmail.com>
@fbricon fbricon force-pushed the empty-selection-selects-line branch from 56b8bb3 to fe8eb5d Compare September 9, 2025 16:20
@fbricon
Copy link
Contributor Author

fbricon commented Sep 9, 2025

@fbricon it looks like the description is still showing the line number of the cursor as the range, although the functionality of including the entire file is working

Fixed

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Sep 9, 2025
@RomneyDa
Copy link
Collaborator

@fbricon thank you!

@RomneyDa RomneyDa merged commit 580fc93 into continuedev:main Sep 11, 2025
81 of 85 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Issues and PRs Sep 11, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Sep 11, 2025
@sestinj
Copy link
Contributor

sestinj commented Sep 11, 2025

🎉 This PR is included in version 1.13.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

lgtm This PR has been approved by a maintainer released size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants