-
Notifications
You must be signed in to change notification settings - Fork 38
feat(context): add visual selection to context #261
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
Conversation
Previously, selections were cleared when switching files, resulting in a loss of context for the user. This change ensures selection state is maintained across file switches, improving UX continuity. This should improve #248
6baeebf to
af62f93
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Adds a new workflow for accumulating visual selections into Opencode context across buffers/files (addressing #248), and updates defaults/docs to expose the new command/keymap.
Changes:
- Stop clearing accumulated selections when switching files during context loading.
- Introduce
add_visual_selection(context + API command) and bind it to<leader>oyin visual mode. - Document the new action/keymap in the README and add a shared
OpencodeSelectionRangetype.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| lua/opencode/types.lua | Adds OpencodeSelectionRange type used for range-based selection APIs. |
| lua/opencode/context/chat_context.lua | Keeps selections when the current file changes (enables accumulation across files). |
| lua/opencode/context/base_context.lua | Extends get_current_selection signature to accept an optional range. |
| lua/opencode/context.lua | Adds context.add_visual_selection() helper to capture and append selections. |
| lua/opencode/config.lua | Adds default <leader>oy mapping for visual-mode selection accumulation. |
| lua/opencode/api.lua | Adds :Opencode add_visual_selection command and API entrypoint. |
| README.md | Documents the new action and keymap. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
84668dc to
d2d320f
Compare
…s buffers - Add add_visual_selection and command This should fix #248
d2d320f to
630e325
Compare
This should fix #248