Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cody: add highlighted text from editor to prompt #51585

Merged
merged 3 commits into from
May 8, 2023
Merged

Conversation

abeatrix
Copy link
Contributor

@abeatrix abeatrix commented May 8, 2023

RE: https://sourcegraph.slack.com/archives/C052G9Y5Y8H/p1683316126807689

Add selected text from editor automatically to the end of the prompt when detected.

Test plan

To test, you can highlight text from your editor, and then ask cody about the selected text without copying and pasting the code to the chat box:
Screenshot 2023-05-08 at 10 09 12 AM

@cla-bot cla-bot bot added the cla-signed label May 8, 2023
@abeatrix abeatrix requested a review from a team May 8, 2023 17:13
@abeatrix abeatrix self-assigned this May 8, 2023
@sourcegraph-buildkite
Copy link
Collaborator

sourcegraph-buildkite commented May 8, 2023

Bundle size report 📦

Initial size Total size Async size Modules
0.00% (0.00 kb) 0.00% (+0.34 kb) 0.00% (+0.34 kb) 0.00% (0)

Look at the Statoscope report for a full comparison between the commits 7512527 and 6dc780f or learn more.

Open explanation
  • Initial size is the size of the initial bundle (the one that is loaded when you open the page)
  • Total size is the size of the initial bundle + all the async loaded chunks
  • Async size is the size of all the async loaded chunks
  • Modules is the number of modules in the initial bundle

@sourcegraph-bot
Copy link
Contributor

sourcegraph-bot commented May 8, 2023

📖 Storybook live preview

Copy link
Contributor

@philipp-spiess philipp-spiess left a comment

Choose a reason for hiding this comment

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

This is awesome! I wonder if we should move it into the getEditorContext part of the chat question recipe though? Reason being that if you have a very large selection (like a 10k file with cmd + a) it might not be super practical to always add the selection context and rather do it in the same way we add the current viewport. WDYT?

@abeatrix abeatrix merged commit fd327b7 into main May 8, 2023
15 checks passed
@abeatrix abeatrix deleted the bee/cody-selection branch May 8, 2023 19:27
@abeatrix
Copy link
Contributor Author

abeatrix commented May 9, 2023

This is awesome! I wonder if we should move it into the getEditorContext part of the chat question recipe though? Reason being that if you have a very large selection (like a 10k file with cmd + a) it might not be super practical to always add the selection context and rather do it in the same way we add the current viewport. WDYT?

Update: that was a really good point and idea. I've moved it into its own context template that's reusable! Thanks for the review 😍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants